Scrubbed Moment from codebase

Moment was still being used in some classes so found and replaced all
those instances with Carbon and uninstalled the packaged from composer.
This commit is contained in:
Ro 2022-09-19 20:39:15 -07:00
parent b092645733
commit 254a7f1c38
7 changed files with 13 additions and 65 deletions

View file

@ -7,6 +7,7 @@ use brain\data\Session;
use brain\data\Settings;
use brain\data\Themes;
use brain\utility\Setup;
use Carbon\Carbon;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Views\Twig;
@ -31,7 +32,7 @@ class DashControl
$template = 'dash/settings.twig';
$member = Session::get('member');
$form_token = Session::get('form_token');
$updated = new \Moment\Moment($settings['global']['last_backup']);
$updated = new Carbon($settings['global']['last_backup']);
$pageOptions = [
'title' => 'Dash Settings',
'private' => $settings['global']['private'],

View file

@ -2,6 +2,7 @@
namespace brain\data;
use Carbon\Carbon;
use brain\utility\DocTools;
use function _\find;
@ -38,7 +39,7 @@ class Member
}
$found[$key] = $data;
//record time updated
$updated = new \Moment\Moment();
$updated = Carbon::now();
$found['updated'] = $updated->format("Y-m-d\TH:i:sP");
$newFolks = [];
array_push($newFolks, $found);

View file

@ -4,6 +4,7 @@ namespace brain\data;
use brain\utility\DocTools;
use brain\utility\Sorting;
use Carbon\Carbon;
use function _\find;
use function _\pull;
@ -67,8 +68,8 @@ class Settings
$page['deleted']
? ($page['deleted'] = 'true')
: ($page['deleted'] = 'false');
$updated = new \Moment\Moment();
$created = new \Moment\Moment($page['rawCreated']);
$updated = Carbon::now();
$created = new Carbon($page['rawCreated']);
$page['created'] = $created->format("Y-m-d\TH:i:sP");
$page['updated'] = $updated->format("Y-m-d\TH:i:sP");

View file

@ -2,6 +2,7 @@
namespace brain\utility;
use Carbon\Carbon;
use brain\data\Settings;
class Maintenance
@ -90,7 +91,7 @@ class Maintenance
$zip->close();
//update settings file with latest back up date
$updated = new \Moment\Moment();
$updated = Carbon::now();
Settings::updateGlobalData(
'last_backup',
$updated->format("Y-m-d\TH:i:sP")

View file

@ -2,6 +2,8 @@
namespace brain\utility;
use Carbon\Carbon;
use function _\find;
class SetUp
@ -33,7 +35,7 @@ class SetUp
$pass = $body['new_member_pass'];
$title = $body['new_member_title'];
$now = new \Moment\Moment();
$now = Carbon::now();
//setup folks config
$hash = password_hash($pass, PASSWORD_DEFAULT);
$newFolks[0]['id'] = 0;

View file

@ -22,7 +22,6 @@
"mnapoli/front-yaml": "^1.8",
"lodash-php/lodash-php": "^0.0.7",
"rbdwllr/reallysimplejwt": "^4.0",
"fightbulc/moment": "^1.33",
"tgalopin/html-sanitizer": "^1.4",
"phpmailer/phpmailer": "^6.4",
"league/commonmark": "^2.1",

59
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5265e13cf91844428ed9c0e717a0f370",
"content-hash": "98a863eb9a0625835e203318bad0dac2",
"packages": [
{
"name": "dflydev/dot-access-data",
@ -187,63 +187,6 @@
},
"time": "2020-11-24T22:02:12+00:00"
},
{
"name": "fightbulc/moment",
"version": "1.33.0",
"source": {
"type": "git",
"url": "https://github.com/fightbulc/moment.php.git",
"reference": "435d68e481ab0a716358926fb51966e696d297e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fightbulc/moment.php/zipball/435d68e481ab0a716358926fb51966e696d297e3",
"reference": "435d68e481ab0a716358926fb51966e696d297e3",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^5.5 || ^6.5 || ^7.5 || ^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Moment\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tino Ehrich",
"email": "tino@bigpun.me",
"role": "developer"
}
],
"description": "Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js",
"keywords": [
"date",
"display",
"format",
"i18n",
"locale",
"manipulate",
"moment",
"parse",
"time",
"translation",
"validate"
],
"support": {
"issues": "https://github.com/fightbulc/moment.php/issues",
"source": "https://github.com/fightbulc/moment.php/tree/1.33.0"
},
"time": "2021-03-27T13:10:08+00:00"
},
{
"name": "league/commonmark",
"version": "2.3.5",