Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/system/databasetable/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/system/databasetable/optimize.class.php
<?php
/**
 * Optimize a database table
 * @package modx
 * @subpackage processors.system.databasetable
 */
class modDatabaseTableOptimizeProcessor extends modDriverSpecificProcessor {
    public function checkPermissions() {
        return $this->modx->hasPermission('database');
    }
    public function getLanguageTopics() {
        return array('system_info');
    }

    public function process() {
        $table = $this->getProperty('t',false);
        if (empty($table)) return $this->failure($this->modx->lexicon('optimize_table_err'));

        if (!$this->optimize($table)) {
            $output = $this->failure($this->modx->lexicon('optimize_table_err'));
        } else {
            $this->logManagerAction();
            $output = $this->success();
        }
        return $output;
    }

    /**
     * Optimize a database table
     * @param string $table
     * @return boolean
     */
    public function optimize($table) {return true;}

    /**
     * Log a manager action showing the optimized table
     * @return void
     */
    public function logManagerAction() {
        if ($this->modx->error->status) {
            $this->modx->logManagerAction('database_optimize','table',$this->getProperty('t'));
        }

    }
}

/**
 * @package modx
 * @subpackage processors.system.databasetable
 */
class modDatabaseTableOptimizeProcessor_mysql extends modDatabaseTableOptimizeProcessor {
    public function optimize($table) {
        $sql = 'OPTIMIZE TABLE '.$this->modx->escape($this->modx->getOption('dbname')).'.'.$this->modx->escape($table);
        return $this->modx->exec($sql) === false ? false : true;
    }
}

/**
 * @package modx
 * @subpackage processors.system.databasetable
 */
class modDatabaseTableOptimizeProcessor_sqlsrv extends modDatabaseTableOptimizeProcessor {
    public function optimize($table) {
        $sql = 'ALTER INDEX ALL ON ' . $this->modx->escape($table) . ' REBUILD';
        return $this->modx->exec($sql) === false ? false : true;
    }
}
return 'modDatabaseTableOptimizeProcessor';

Spamworldpro Mini