| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/konzalta/public_html/wp-content/plugins/wappointment/app/Controllers/ |
Upload File : |
<?php
namespace Wappointment\Controllers;
use Wappointment\ClassConnect\Request;
use Wappointment\Services\Health;
use Wappointment\Services\Permissions;
use Wappointment\Services\Wappointment\Feedback;
use Wappointment\System\Status;
// @codingStandardsIgnoreFile
class AppController extends \Wappointment\Controllers\RestController
{
public function migrate(Request $request)
{
if (Status::coreRequiresDBUpdate()) {
return $this->runUpdatesCore();
}
return $this->runUpdatesAddons();
}
public function health()
{
$perms = new Permissions();
$perms->refreshStaffCap();
return (new Health())->get();
}
protected function runUpdatesCore()
{
$migrator = new \Wappointment\Installation\Migrate();
$migrated = $migrator->migrate();
if (!empty($migrated)) {
Status::dbVersionUpdateComplete();
return ['message' => 'Database has been updated', 'migrated' => $migrated];
}
throw new \WappointmentException("Database could not be updated", 1);
}
protected function runUpdatesAddons()
{
$addonsRequiringUpdate = Status::addonRequiresDBUpdate();
if (!$addonsRequiringUpdate) {
throw new \WappointmentException("There is no update to run", 1);
}
foreach ($addonsRequiringUpdate as $addon_details) {
try {
\call_user_func($addon_details['namespace'] . '::runDbMigrate');
} catch (\Throwable $th) {
throw new \WappointmentValidationException("Could not update addon db", 1, null, [$th->getMessage()]);
}
}
return ['message' => 'Database for addons has been updated'];
}
public function sendFeedback(Request $request)
{
$feedback = new Feedback();
$feedback->sendFeedback($request);
return ['message' => 'Feedback sent', 'result' => \true];
}
}