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.
pull/84/head
Ro 2 years ago
parent b092645733
commit 254a7f1c38

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

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

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

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

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

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

59
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5265e13cf91844428ed9c0e717a0f370", "content-hash": "98a863eb9a0625835e203318bad0dac2",
"packages": [ "packages": [
{ {
"name": "dflydev/dot-access-data", "name": "dflydev/dot-access-data",
@ -187,63 +187,6 @@
}, },
"time": "2020-11-24T22:02:12+00:00" "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", "name": "league/commonmark",
"version": "2.3.5", "version": "2.3.5",

Loading…
Cancel
Save