コード例 #1
0
ファイル: bootstrap.php プロジェクト: noikiy/xmpp-chat
 /**
  * Checks automated hosting structure
  * 
  * This part is executed once in manager is run this cronjob.
  * php cron.php -s site_admin -e instance -c cron/extensions_update
  * 
  * */
 public function checkStructure()
 {
     // Just do table updates
     erLhcoreClassUpdate::doTablesUpdate(json_decode(file_get_contents('extension/xmppservice/doc/structure.json'), true));
     // Shared rosters for standalone enviroment have to be created manually
     if ($this->settings['ahosting'] == true) {
         erLhcoreClassExtensionXmppserviceHandler::checkSharedRoasters(array('subdomain' => $this->settings['subdomain'], 'xmpp_host' => $this->settings['xmpp_host'], 'node_api_server' => $this->settings['node_api_server'], 'handler' => $this->settings['handler'], 'rpc_server' => $this->settings['rpc_server'], 'rpc_username' => $this->settings['rpc_username'], 'rpc_password' => $this->settings['rpc_password'], 'rpc_account_host' => $this->settings['rpc_account_host']));
     }
 }
コード例 #2
0
ファイル: update.php プロジェクト: nagyistoce/livehelperchat
<?php

if ((string) $Params['user_parameters_unordered']['action'] == 'statusdb' || (string) $Params['user_parameters_unordered']['action'] == 'statusdbdoupdate') {
    if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
        echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token'));
        exit;
    }
    $tpl = erLhcoreClassTemplate::getInstance('lhsystem/update/statusdb.tpl.php');
    $contentData = erLhcoreClassModelChatOnlineUser::executeRequest('https://raw.githubusercontent.com/LiveHelperChat/livehelperchat/master/lhc_web/doc/update_db/structure.json');
    if ((string) $Params['user_parameters_unordered']['action'] == 'statusdbdoupdate') {
        erLhcoreClassUpdate::doTablesUpdate(json_decode($contentData, true));
    }
    $tables = erLhcoreClassUpdate::getTablesStatus(json_decode($contentData, true));
    $tpl->set('tables', $tables);
    echo json_encode(array('result' => $tpl->fetch()));
    exit;
}
$tpl = erLhcoreClassTemplate::getInstance('lhsystem/update.tpl.php');
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/update', 'Live Helper Chat update information')));
コード例 #3
0
<?php

// php cron.php -s site_admin -e instance -c cron/update_instances
echo "Updating instances\n";
$contentData = erLhcoreClassModelChatOnlineUser::executeRequest('https://raw.githubusercontent.com/LiveHelperChat/livehelperchat/master/lhc_web/doc/update_db/structure.json');
$cfg = erConfigClassLhConfig::getInstance();
$db = ezcDbInstance::get();
foreach (erLhcoreClassModelInstance::getList(array('limit' => 1000000, 'filter' => array('status' => erLhcoreClassModelInstance::WORKING))) as $instance) {
    echo "Updating database for customer - ", $instance->id, "\n";
    $db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . $instance->id);
    erLhcoreClassUpdate::doTablesUpdate(json_decode($contentData, true));
}
$CacheManager = erConfigClassLhCacheConfig::getInstance();
$CacheManager->expireCache();
コード例 #4
0
    ezcBaseFile::removeRecursive('var/tmpfiles/backupfiles');
    if (!file_exists('var/tmpfiles/backupfiles')) {
        mkdir('var/tmpfiles/backupfiles');
        mkdir('var/tmpfiles/backupfiles/design');
    }
    $zip->extractTo('var/tmpfiles/update');
    $zip->close();
    $foldersSwitch = array('doc', 'ezcomponents', 'lib', 'modules', 'pos', 'translations', 'design/backendtheme', 'design/defaulttheme');
    echo "Switching folders\n";
    foreach ($foldersSwitch as $folder) {
        rename($folder, 'var/tmpfiles/backupfiles/' . $folder . '_' . $date);
        rename('var/tmpfiles/update/livehelperchat-master/lhc_web/' . $folder, $folder);
    }
    unlink('var/tmpfiles/master.zip');
    echo "Your old folders can be found - var/tmpfiles/backupfiles\n";
    ezcBaseFile::removeRecursive('var/tmpfiles/update');
    $jsonObject = json_decode(erLhcoreClassModelChatOnlineUser::executeRequest('https://raw.githubusercontent.com/LiveHelperChat/livehelperchat/master/lhc_web/doc/update_db/structure.json'), true);
    echo "----------------\nUpdating database\n----------------\n";
    if (is_array($jsonObject)) {
        $errorMessages = erLhcoreClassUpdate::doTablesUpdate($jsonObject);
        if (empty($errorMessages)) {
            $CacheManager = erConfigClassLhCacheConfig::getInstance();
            $CacheManager->expireCache();
            echo "UPDATE DONE\n";
        } else {
            echo "ERROR:\n" . implode("\n", $errorMessages);
        }
    }
} else {
    echo "Could not download archive!!!";
}