v1.0 Initial commit of project
This commit is contained in:
34
pub/api/classes/API_system_modules.php
Normal file
34
pub/api/classes/API_system_modules.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace api\classes;
|
||||
|
||||
use api\classes\API;
|
||||
|
||||
require_once 'API.php';
|
||||
|
||||
class API_system_modules extends API
|
||||
{
|
||||
public function getModules($returnBoolean = false)
|
||||
{
|
||||
list($query, $types, $params) = $this->buildDynamicQuery('system_modules');
|
||||
|
||||
$items = $this->generalGetFunction($query, $types, $params, $returnBoolean, 'Permission');
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function enableModule()
|
||||
{
|
||||
|
||||
$module_uuid_enabled = ($this->data['module_enabled']) ? 0 : 1;
|
||||
|
||||
# Module 'system cannot be disabled'
|
||||
$query = "UPDATE system_modules SET module_enabled = ? WHERE module_uuid = ? AND module_slugify != 'system'";
|
||||
$stmt = $this->prepareStatement($query);
|
||||
$stmt->bind_param('is', $module_uuid_enabled, $this->data['module_uuid']);
|
||||
|
||||
if ($this->executeStatement($stmt)) {
|
||||
$this->apiOutput(200, ['success' => 'Module ' . ($module_uuid_enabled ? 'enabled' : 'disabled') . ' successfully.']);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user