Exemplo n.º 1
0
function cache_clear_all($options = null)
{
    if (conf::isCli()) {
        common::needRoot();
    }
    clear::all();
    return 0;
}
Exemplo n.º 2
0
 /**
  * set account timezone (account_timezone)
  */
 public static function setAccountTimezone()
 {
     // set user timezone - only in web mode
     if (!conf::isCli()) {
         $timezone = cache::get('account_timezone', session::getUserId());
         if ($timezone) {
             date_default_timezone_set($timezone);
         } else {
             self::setCookieTimezone();
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Set a log level based on env and debug
  */
 public static function setLogLevel()
 {
     $env = conf::getEnv();
     if ($env == 'development') {
         error_reporting(E_ALL);
     }
     // check if we are in debug mode and display errors
     if (conf::getMainIni('debug')) {
         ini_set('display_errors', 1);
     }
     if (conf::isCli()) {
         self::setErrorLog();
     }
 }
Exemplo n.º 4
0
        return db_no_url();
    }
    if ($info['scheme'] == 'mysql') {
        $ok = true;
    }
    if ($info['scheme'] == 'mysqli') {
        $ok = true;
    }
    if (!$ok) {
        common::echoStatus('ERROR', 'r', 'Driver needs to be mysql or mysqli');
    }
    $fs = new Filesystem();
    $fs->remove('sqlite/database.sql');
    $username = conf::getMainIni('username');
    $password = conf::getMainIni('password');
    $command = "sequel ";
    $command .= "{$info['scheme']}://{$username}:{$password}@{$info['host']}/{$info['dbname']} ";
    $command .= "-C ";
    $command .= "sqlite://sqlite/database.sql";
    $ret = common::systemCommand($command);
    $base = conf::pathBase();
    if (!$ret) {
        $fs->chmod('sqlite/database.sql', 0777, 00, true);
        common::echoMessage('Sqlite database created. Edit config.ini and add:');
        common::echoMessage("sqlite:/{$base}/sqlite/database.sql");
    }
}
if (conf::isCli()) {
    self::setCommand('sqlite', array('description' => 'Sqlite database commands.'));
    self::setOption('db_to_sqlite', array('long_name' => '--mysql-to-sqlite', 'description' => 'Create a sqlite3 database from current MySQL database. Will be placed in sqlite/database.sql', 'action' => 'StoreTrue'));
}
Exemplo n.º 5
0
 /**
  * Method for setting a profile's template
  * @param string $template
  * @return boolean $res
  */
 public function setProfileTemplate($template = null)
 {
     $db = new db();
     $db->connect();
     if (isset($template)) {
         $this->profileTemplate = $template;
     }
     $ini_file = conf::pathHtdocs() . "/templates/{$this->profileTemplate}/{$this->profileTemplate}.ini";
     $ini_file_dist = $ini_file . "-dist";
     if (conf::isCli()) {
         if (file_exists($ini_file_dist)) {
             copy($ini_file_dist, $ini_file);
         }
     }
     $values = array('template' => $this->profileTemplate);
     return $db->update('settings', $values, 1);
 }