Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Ready for production!
  • Loading branch information
NaysKutzu committed Oct 2, 2024
1 parent db5e870 commit cd56472
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
24 changes: 2 additions & 22 deletions Backup24.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,8 @@

class Backup24 implements PluginBuilder
{
public function Main(): void
{
// DO nothing since you don't need to do something :)
}

public function Event(MythicalSystemsFramework\Plugins\PluginEvent $eventHandler): void
{
require __DIR__ . '/ClassHandler.php';

// Load routes
$eventHandler->on('app.onAppLoad', function ($router, $renderer) {
/**
* Routes for the Backup24 plugin.
*/
$router->add('/addons/backup24/info', function () {
global $renderer;

exit(ClassHandler::getLastBackup() . ' | ' . ClassHandler::getCurrentSystemTime() . ' | Is it time for backup? ' . ClassHandler::isTimeForBackup());
});
});
}

public function Main(): void {}
public function Event(MythicalSystemsFramework\Plugins\PluginEvent $eventHandler): void {}
public function onInstall(): void
{
require __DIR__ . '/ClassHandler.php';
Expand Down
4 changes: 1 addition & 3 deletions ClassHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function updateLastBackup()
{
$mysql = new MySQL();
$conn = $mysql->connectMYSQLI();
$conn->query('UPDATE `' . self::TABLE_NAME . '` SET `last_backup` = CURRENT_TIMESTAMP WHERE `id` = 1');
$conn->query('UPDATE `' . self::TABLE_NAME . '` SET `' . self::$columns[1] . '` = CURRENT_TIMESTAMP WHERE `' . self::$columns[0] . '` = 1');
}

/**
Expand Down Expand Up @@ -100,9 +100,7 @@ public static function isTimeForBackup(): bool
if (($currentTime - $lastBackupTime) >= 86400) {
return true;
}

return false;

}

/**
Expand Down

0 comments on commit cd56472

Please sign in to comment.