本文整理汇总了PHP中DBG::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP DBG::dump方法的具体用法?PHP DBG::dump怎么用?PHP DBG::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBG
的用法示例。
在下文中一共展示了DBG::dump方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _utf8Update
/**
* Cloudrexx
*
* @link http://www.cloudrexx.com
* @copyright Cloudrexx AG 2007-2015
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Cloudrexx" is a registered trademark of Cloudrexx AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*/
function _utf8Update()
{
global $objUpdate, $_DBCONFIG, $objDatabase, $_ARRAYLANG, $_CORELANG;
$preferedCollation = 'utf8_unicode_ci';
$usedCollation = '';
$result = true;
// fetch currently used collation
try {
$objResult = \Cx\Lib\UpdateUtil::sql('SHOW CREATE TABLE `' . DBPREFIX . 'access_users`');
if ($objResult->EOF) {
setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'access_users'));
return false;
}
$createStatement = $objResult->fields['Create Table'];
// note: if charset latin1 is used, collation won't be set
$matches = array();
if (preg_match('/COLLATE=([a-z_0-9]*)/', $createStatement, $matches)) {
$usedCollation = $matches[1];
}
\DBG::dump('Currently used collation: ' . $usedCollation);
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
// fetch available collations
$arrCollations = _getUtf8Collations();
if (!is_array($arrCollations)) {
return $arrCollations;
}
if (!isset($_SESSION['contrexx_update']['update']['core'])) {
$_SESSION['contrexx_update']['update']['core'] = array();
}
// note: $usedCollation is the currently used collation.
// in case $usedCollation is non-utf8, then the following var
// won't be set. This will cause the update system to ask the user
// to select an utf8 collation.
if (in_array($usedCollation, $arrCollations)) {
$_SESSION['contrexx_update']['update']['core']['utf8_collation'] = $usedCollation;
}
if (isset($_DBCONFIG['charset']) && $_DBCONFIG['charset'] == 'utf8') {
// do not update templates if they should be utf8 already
$_SESSION['contrexx_update']['update']['utf'] = true;
}
// show dialog to select utf8 collation
if (empty($_SESSION['contrexx_update']['update']['core']['utf8_collation'])) {
if (isset($_POST['dbCollation']) && in_array($objUpdate->stripslashes($_POST['dbCollation']), $arrCollations)) {
$_SESSION['contrexx_update']['update']['core']['utf8_collation'] = $objUpdate->stripslashes($_POST['dbCollation']);
} else {
$collationMenu = '<select name="dbCollation">';
foreach ($arrCollations as $collation) {
$collationMenu .= '<option value="' . $collation . '"' . ($collation == $preferedCollation ? ' selected="selected"' : '') . '>' . $collation . '</option>';
}
$collationMenu .= '</select><br />';
setUpdateMsg($_ARRAYLANG['TXT_SELECT_DB_COLLATION'], 'title');
setUpdateMsg(sprintf($_ARRAYLANG['TXT_SELECT_DB_COLLATION_MSG'] . '<br /><br />', $collationMenu), 'msg');
setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
return false;
}
}
// WRITE COLLATION TO CONFIG FILE IF NECESSARY
if (empty($_DBCONFIG['collation'])) {
\DBG::msg('New collation set in _utf8Update(): ' . $_SESSION['contrexx_update']['update']['core']['utf8_collation']);
// configuration.php will get written by core.php's _writeNewConfigurationFile()
$_DBCONFIG['collation'] = $_SESSION['contrexx_update']['update']['core']['utf8_collation'];
// IMPORTANT!
// setting result to 'charset_changed' will cause a reinitialization of the update system
// to ensure that the db-connections use the proper charset/collation
$result = 'charset_changed';
}
// SET DATABASE CHARSET AND COLLATION
try {
$objDbStatement = \Cx\Lib\UpdateUtil::sql("SHOW CREATE DATABASE `" . $_DBCONFIG['database'] . "`");
if (!preg_match('#DEFAULT\\sCHARACTER\\sSET\\sutf8\\sCOLLATE\\s' . $_SESSION['contrexx_update']['update']['core']['utf8_collation'] . '#s', $objDbStatement->fields['Create Database'])) {
\Cx\Lib\UpdateUtil::sql("ALTER DATABASE `" . $_DBCONFIG['database'] . "` DEFAULT CHARACTER SET utf8 COLLATE " . $objUpdate->addslashes($_SESSION['contrexx_update']['update']['core']['utf8_collation']));
}
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
//.........这里部分代码省略.........
示例2: processUpdate
private function processUpdate()
{
global $_CORELANG, $_CONFIG, $_ARRAYLANG;
$this->objTemplate->addBlockfile('CONTENT', 'process', 'process.html');
if (($return = $this->_loadUpdateLanguage()) !== true) {
$this->objTemplate->setVariable('UPDATE_ERROR_MSG', $return);
$this->objTemplate->parse('updateProcessError');
} elseif (($arrVersions = $this->getAvailabeVersions()) === false || !@(include_once UPDATE_UPDATES . '/' . $_SESSION['contrexx_update']['version'] . '/' . $arrVersions[$_SESSION['contrexx_update']['version']]['script'])) {
$this->objTemplate->setVariable('UPDATE_ERROR_MSG', $_CORELANG['TXT_UPDATE_UNABLE_TO_START']);
$this->objTemplate->parse('updateProcessError');
} else {
if (!$this->_isNewerVersion($_CONFIG['coreCmsVersion'], $_SESSION['contrexx_update']['version'])) {
$result = true;
} else {
if (!empty($_POST['execution_time'])) {
$_SESSION['contrexx_update']['max_execution_time'] = intval($_POST['execution_time']);
if (intval($_POST['execution_time']) < 20) {
setUpdateMsg('<div class="message-warning">' . $_CORELANG['TXT_UPDATE_EXECUTION_TIME'] . '</div>', 'msg');
setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
$result = false;
} else {
die('{"time": ' . intval($_POST['execution_time']) . '}');
}
} else {
try {
if (!activateDebugging()) {
throw new \Exception("The debugging file couldn't be created.");
}
$result = true;
} catch (\Exception $e) {
setUpdateMsg($_CORELANG['TXT_UPDATE_DBG_FILE'], 'msg');
setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="skipDebugMsg" id="skipDebugMsg" value="skipDebugMsg" />', 'button');
if (empty($_POST['skipDebugMsg'])) {
$result = false;
}
}
if ($result !== false) {
DBG::msg('-------------------------------------------------------------');
DBG::msg('CLOUDREXX UPDATE - NEW REQUEST');
DBG::msg('Date: ' . date('d.m.Y H:i:s'));
DBG::msg('Get-Params:');
DBG::dump($_GET);
DBG::msg('User: ' . $_SESSION['contrexx_update']['username']);
DBG::msg('-------------------------------------------------------------');
$result = executeContrexxUpdate();
}
}
}
if ($result !== true) {
if (!empty($this->arrStatusMsg['error'])) {
$this->objTemplate->setVariable('UPDATE_ERROR_MSG', implode('<br />', $this->arrStatusMsg['error']));
$this->objTemplate->parse('updateProcessError');
}
if (empty($this->arrStatusMsg['title'])) {
$this->arrStatusMsg['title'] = 'Update Fehler';
}
if (empty($this->arrStatusMsg['button'])) {
$this->arrStatusMsg['button'] = '<input type="submit" value="' . $_CORELANG['TXT_UPDATE_TRY_AGAIN'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />';
}
if (!empty($this->arrStatusMsg['dialog']) && empty($this->arrStatusMsg['error'])) {
$this->objTemplate->hideBlock('processStatus');
$dialogContent = implode('<br />', $this->arrStatusMsg['msg']);
if (!$this->ajax) {
$dialogContent = str_replace(array('\'', "\r\n"), array('\\\'', ''), $dialogContent);
}
$this->objTemplate->setVariable('PROCESS_DIALOG_CONTENT', $dialogContent);
if ($this->ajax) {
$this->html['dialog'] = $this->arrStatusMsg['dialog'];
$this->objTemplate->parse('ajaxDialogContent');
} else {
$this->objTemplate->parse('dialogContent');
}
} else {
if (!empty($this->arrStatusMsg['timeout']) && empty($this->arrStatusMsg['error'])) {
$this->html['timeout'] = $this->arrStatusMsg['timeout'];
} else {
$this->objTemplate->hideBlock('dialogContent');
$this->objTemplate->hideBlock('ajaxDialogContent');
$this->objTemplate->setVariable(array('UPDATE_PROCESS_TITLE' => $_CORELANG['TXT_UPDATE_UPDATE_PROCESS'], 'UPDATE_STATUS_TITLE' => $this->arrStatusMsg['title'], 'UPDATE_STATUS' => str_replace('[[SQL_INFO_TITLE]]', $this->arrStatusMsg['title'], implode('<br />', $this->arrStatusMsg['msg']))));
$this->setNavigation($this->arrStatusMsg['button']);
}
}
} else {
$this->objTemplate->hideBlock('dialogContent');
$this->objTemplate->hideBlock('ajaxDialogContent');
$this->objTemplate->hideBlock('processStatus');
$urlFrontend = ASCMS_PATH_OFFSET !== '' ? ASCMS_PATH_OFFSET : '/';
if (!empty($_SESSION['contrexx_update']['modified_files']) && count($_SESSION['contrexx_update']['modified_files'])) {
foreach ($_SESSION['contrexx_update']['modified_files'] as $arrFile) {
$this->objTemplate->setVariable(array('BACKUP_FILE_SRC' => $arrFile['src'], 'BACKUP_FILE_DST' => $arrFile['dst']));
$this->objTemplate->parse('backed_file');
}
$this->objTemplate->parse('backed_files');
} else {
$this->objTemplate->hideblock('backed_files');
}
if (!empty($_SESSION['contrexx_update']['modified_cmds']) && count($_SESSION['contrexx_update']['modified_cmds'])) {
foreach ($_SESSION['contrexx_update']['modified_cmds'] as $arrCmds) {
$this->objTemplate->setVariable(array('CHANGED_CMD_PAGE_TITLE' => $arrCmds['pageTitle'], 'CHANGED_CMD_ORIG_CMD' => $arrCmds['origCmd'], 'CHANGED_CMD_NEW_CMD' => $arrCmds['newCmd']));
$this->objTemplate->parse('changed_cmd');
//.........这里部分代码省略.........
示例3: preResolve
public function preResolve(\Cx\Core\Routing\Url $url)
{
if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
return;
}
$em = $this->cx->getDb()->getEntityManager();
$rewriteRuleRepo = $em->getRepository($this->getNamespace() . '\\Model\\Entity\\RewriteRule');
$rewriteRules = $rewriteRuleRepo->findAll(array(), array('order' => 'asc'));
$last = false;
$originalUrl = clone $url;
foreach ($rewriteRules as $rewriteRule) {
try {
$url = $rewriteRule->resolve($url, $last);
} catch (\Exception $e) {
// This is thrown if the regex of the rule is not valid
}
if ($last) {
break;
}
}
if ($originalUrl->toString() != $url->toString()) {
if ($rewriteRule->getRewriteStatusCode() != \Cx\Core\Routing\Model\Entity\RewriteRule::REDIRECTION_TYPE_INTERN) {
$headers = array('Location' => $url->toString());
if ($rewriteRule->getRewriteStatusCode() == 301) {
array_push($headers, $_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
}
$this->getComponent('Cache')->writeCacheFileForRequest(null, $headers, '');
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . $url->toString(), true, $rewriteRule->getRewriteStatusCode());
die;
}
try {
\DBG::log('Fetching content from ' . $url->toString());
$request = new \HTTP_Request2($url->toString(), \HTTP_Request2::METHOD_GET);
$request->setConfig(array('follow_redirects' => true));
$response = $request->send();
$content = $response->getBody();
foreach ($response->getHeader() as $key => $value) {
if (in_array($key, array('content-encoding', 'transfer-encoding'))) {
continue;
}
\Cx\Core\Csrf\Controller\Csrf::header($key . ':' . $value);
}
$continue = false;
die($content);
} catch (\HTTP_Request2_Exception $e) {
\DBG::dump($e);
}
}
}
示例4: getJson
/**
* Fetches a json response via HTTP request
* @todo Support cookies (to allow login and similiar features)
* @param string $url URL to get json from
* @param array $data (optional) HTTP post data
* @param boolean $secure (optional) Wheter to verify peer using SSL or not, default false
* @param string $certificateFile (optional) Local certificate file for non public SSL certificates
* @param array Set an optional HTTP Authentication method and supply its login credentials.
* The supplied array must comply with the following structure:
* <pre class="brush: php">
* $httpAuth = array(
* 'httpAuthMethod' => 'none|basic|disgest',
* 'httpAuthUsername' => '<username>',
* 'httpAuthPassword' => '<password>',
* );
* </pre>
* @return mixed Decoded JSON on success, false otherwise
*/
public function getJson($url, $data = array(), $secure = false, $certificateFile = '', $httpAuth = array(), $files = array())
{
$request = new \HTTP_Request2($url, \HTTP_Request2::METHOD_POST);
if (!empty($httpAuth)) {
switch ($httpAuth['httpAuthMethod']) {
case 'basic':
$request->setAuth($httpAuth['httpAuthUsername'], $httpAuth['httpAuthPassword'], \HTTP_Request2::AUTH_BASIC);
break;
case 'disgest':
$request->setAuth($httpAuth['httpAuthUsername'], $httpAuth['httpAuthPassword'], \HTTP_Request2::AUTH_DIGEST);
break;
case 'none':
default:
break;
}
}
foreach ($data as $name => $value) {
$request->addPostParameter($name, $value);
}
if (!empty($files)) {
foreach ($files as $fieldId => $file) {
$request->addUpload($fieldId, $file);
}
}
if ($this->sessionId !== null) {
$request->addCookie(session_name(), $this->sessionId);
}
$request->setConfig(array('ssl_verify_host' => false, 'ssl_verify_peer' => false, 'follow_redirects' => true, 'strict_redirects' => true));
$response = $request->send();
//echo '<pre>';var_dump($response->getBody());echo '<br /><br />';
$cookies = $response->getCookies();
foreach ($cookies as &$cookie) {
if ($cookie['name'] === session_name()) {
$this->sessionId = $cookie['value'];
break;
}
}
if ($response->getStatus() != 200) {
\DBG::msg(__METHOD__ . ' Request failed! Status: ' . $response->getStatus());
\DBG::msg('URL: ' . $url);
\DBG::dump($data);
return false;
}
$body = json_decode($response->getBody());
if ($body === NULL) {
\DBG::msg(__METHOD__ . ' failed!');
\DBG::dump($response->getBody());
}
return $body;
}
示例5: fetchResponse
protected function fetchResponse($license, $_CONFIG, $forceTemplate, $_CORELANG)
{
$v = preg_split('#\\.#', $_CONFIG['coreCmsVersion']);
$e = $_CONFIG['coreCmsEdition'];
$version = current($v);
unset($v[key($v)]);
foreach ($v as $part) {
$version *= 100;
$version += $part;
}
$srvUri = 'updatesrv1.contrexx.com';
$srvPath = '/';
$data = array('installationId' => $license->getInstallationId(), 'licenseKey' => $license->getLicenseKey(), 'edition' => $license->getEditionName(), 'version' => $this->coreCmsVersion, 'versionstate' => $this->coreCmsStatus, 'domainName' => $this->domainUrl, 'sendTemplate' => $forceTemplate);
if (true) {
try {
$objFile = new \Cx\Lib\FileSystem\File(ASCMS_INSTANCE_PATH . ASCMS_INSTANCE_OFFSET . '/config/License.lic');
$rawData = $objFile->getData();
$response = json_decode(base64_decode($rawData));
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
$license->setState(License::LICENSE_ERROR);
$license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR'])));
$license->check();
throw $e;
}
return $response;
}
$a = $_SERVER['REMOTE_ADDR'];
$r = 'http://';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$r = 'https://';
}
$r .= $_SERVER['SERVER_NAME'] . ASCMS_INSTANCE_OFFSET;
$request = new \HTTP_Request2('http://' . $srvUri . $srvPath . '?v=' . $version, \HTTP_Request2::METHOD_POST);
$request->setHeader('X-Edition', $e);
$request->setHeader('X-Remote-Addr', $a);
$request->setHeader('Referer', $r);
$jd = new \Cx\Core\Json\JsonData();
$request->addPostParameter('data', $jd->json($data));
try {
$objResponse = $request->send();
if ($objResponse->getStatus() !== 200) {
$license->setState(License::LICENSE_ERROR);
$license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR'])));
$license->check();
return null;
} else {
\DBG::dump($objResponse->getBody());
$response = json_decode($objResponse->getBody());
}
} catch (\HTTP_Request2_Exception $objException) {
$license->setState(License::LICENSE_ERROR);
$license->setGrayzoneMessages(array(\FWLanguage::getLanguageCodeById(LANG_ID) => new Message(\FWLanguage::getLanguageCodeById(LANG_ID), $_CORELANG['TXT_LICENSE_COMMUNICATION_ERROR'])));
$license->check();
throw $objException;
}
return $response;
}
示例6: __construct
//.........这里部分代码省略.........
$this->loadSettings();
/**
* Checks if the system has been installed (CONTREXX_INSTALLED).
* If not, the user will be redirected to the web-installer.
*/
if ($checkInstallationStatus) {
$this->checkInstallationStatus();
}
/**
* Verifies that the basic configuration ($_CONFIG) has bee loaded.
* If not, the system will halt.
*/
$this->checkBasicConfiguration();
/**
* Sets the path to the customizing directory (/customizing) of the website,
* if the associated functionality has been activatd.
*/
$this->setCustomizingPath();
/**
* Sets the mode Cloudrexx runs in
* One of self::MODE_[FRONTEND|BACKEND|CLI|MINIMAL]
*/
$this->setMode($mode);
/**
* Early initializations. Verifies that the system is online (not suspended).
* Initializes the ClassLoader, the legacy Environment variables and executes
* the preInit-hook-scripts. Finally it verifies the requested HTTP-Host.
*/
$this->preInit();
/**
* Defines the core constants (ASCMS_*) of Cloudrexx as defined in config/set_constants.php
* and config/SetCustomizableConstants.php.
*/
$this->defineLegacyConstants();
/**
* Loads ClassLoader, EventManager and Database connection
* For now, this also loads some legacy things like API, AdoDB, Env and InitCMS
*/
$this->init();
/**
* In order to make this file customizable, we explicitly
* search for a subclass of Cx\Core\Core\Controller\Cx named Cx\Customizing\Core\Cx
* If such a class is found, it is loaded and this request will be stopped
*/
$this->handleCustomizing();
/**
* Initialize license
*/
$this->preComponentLoad();
/**
* Loads all active components
*/
$this->loadComponents();
$this->postComponentLoad();
/**
* Initialize request
* Request is not initialized for command mode
*/
$this->postInit();
/**
* Since we have a valid state now, we can start executing
* all of the component's hook methods.
* This initializes the main template, executes all hooks
* and parses the template.
*
* This is not executed automaticly in minimal. Invoke it
* yourself if necessary and be sure to handle exceptions.
*
* Command mode is different ;-)
*/
if ($this->mode == self::MODE_MINIMAL) {
return;
}
$this->loadContrexx();
} catch (InstanceException $e) {
return;
} catch (\Cx\Core\Error\Model\Entity\ShinyException $e) {
if ($this->mode != self::MODE_BACKEND) {
throw new \Exception($e->getMessage());
}
// reset root of Cx\Core\Html\Sigma to backend template path
$this->template->setRoot($this->codeBaseAdminTemplatePath);
$this->template->setVariable('ADMIN_CONTENT', $e->getBackendViewMessage());
$this->setPostContentLoadPlaceholders();
$this->finalize();
die;
} catch (\Exception $e) {
\header($_SERVER['SERVER_PROTOCOL'] . ' 500 Server Error');
if (file_exists($this->websiteDocumentRootPath . '/offline.html')) {
$offlinePath = $this->websiteDocumentRootPath;
} else {
$offlinePath = $this->codeBaseDocumentRootPath;
}
echo file_get_contents($offlinePath . '/offline.html');
\DBG::msg('Cloudrexx initialization failed! ' . get_class($e) . ': "' . $e->getMessage() . '"');
\DBG::msg('In file ' . $e->getFile() . ' on Line ' . $e->getLine());
\DBG::dump($e->getTrace());
die;
}
}
示例7: _calculateNewCss
/**
* Merges CSS definitions of modules with updated template
* @return mixed Additional CSS definitions as string or false on error
*/
function _calculateNewCss(&$viewUpdateTable, &$moduleStyles, $objUpdate)
{
global $_CONFIG;
// Calculate new CSS definitions
$additionalCss = array();
foreach ($viewUpdateTable as $module => $data) {
$version = $data['version'];
$dependencies = $data['dependencies'];
// only add css if the installed version is older than $version
if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], $version)) {
continue;
}
if (!isset($moduleStyles[$module])) {
\DBG::msg('No style definitions for module "' . $module . '" in this theme type');
continue;
}
if (!isset($additionalCss[$module])) {
$additionalCss[$module] = $moduleStyles[$module];
}
foreach ($dependencies as $module) {
if (!isset($additionalCss[$module])) {
$additionalCss[$module] = $moduleStyles[$module];
}
}
}
\DBG::msg('--- added modules css definitions for modules: ---');
\DBG::dump(array_keys($additionalCss));
$additionalCss = implode("\r\n\r\n", $additionalCss);
return $additionalCss;
}
示例8: dirname
\DBG::dump($calendarMigration);
return $calendarMigration;
}
// rewrite backendAreas
require_once dirname(__FILE__) . '/components/core/backendAreas.php';
$backendAreasUpdate = _updateBackendAreas();
if ($backendAreasUpdate !== true) {
return $backendAreasUpdate;
}
} elseif ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.1')) {
$calendarComponentUpdateFile = dirname(__FILE__) . '/components/module/calendar.php';
require_once $calendarComponentUpdateFile;
$CalendarUpdate31 = new CalendarUpdate31();
$calendarMigration = $CalendarUpdate31->migrateContentPages();
if ($calendarMigration !== true) {
\DBG::dump($calendarMigration);
return $calendarMigration;
}
}
/***************************************
*
* CONTACT: Add multi-file upload field
*
**************************************/
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) {
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_field', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'id_form' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'type' => array('type' => 'ENUM(\'text\',\'label\',\'checkbox\',\'checkboxGroup\',\'country\',\'date\',\'file\',\'multi_file\',\'fieldset\',\'hidden\',\'horizontalLine\',\'password\',\'radio\',\'select\',\'textarea\',\'recipient\',\'special\')', 'notnull' => true, 'default' => 'text'), 'special_type' => array('type' => 'VARCHAR(20)', 'notnull' => true), 'is_required' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'check_type' => array('type' => 'INT(3)', 'notnull' => true, 'default' => '1'), 'order_id' => array('type' => 'SMALLINT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0')));
// change all fields currently set to 'file' to 'multi_file' ('multi_file' is same as former 'file' in previous versions)
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_contact_form_field` SET `type` = 'multi_file' WHERE `type` = 'file'");
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
示例9: updateToDb
/**
* Update given object to database
* Callable from RecursiveArrayAccess class on offsetSet
*
* @param RecursiveArrayAccess $recursiveArrayAccess session object array
*/
public static function updateToDb($recursiveArrayAccess)
{
if (empty($recursiveArrayAccess->id) && (string) $recursiveArrayAccess->offset != '') {
$query = 'INSERT INTO
' . DBPREFIX . 'session_variable
SET
`parent_id` = "' . intval($recursiveArrayAccess->parentId) . '",
`sessionid` = "' . static::getInstance()->sessionid . '",
`key` = "' . contrexx_input2db($recursiveArrayAccess->offset) . '",
`value` = ""';
\Env::get('db')->Execute($query);
$recursiveArrayAccess->id = \Env::get('db')->Insert_ID();
}
foreach ($recursiveArrayAccess->data as $key => $value) {
if ($recursiveArrayAccess->isDirty($key)) {
if (is_a($value, 'Cx\\Core\\Model\\RecursiveArrayAccess')) {
$serializedValue = '';
} else {
// is_callable() can return true for type array, so we need to check that it is not an array
if (!is_array($value) && !is_string($value) && is_callable($value)) {
\DBG::dump('Function for session index ' . $key . ' can not be stored, saving functions in session is not supported. Please use json instead');
continue;
}
$serializedValue = contrexx_input2db(serialize($value));
}
$query = 'INSERT INTO
' . DBPREFIX . 'session_variable
SET
`parent_id` = "' . intval($recursiveArrayAccess->id) . '",
`sessionid` = "' . static::getInstance()->sessionid . '",
`key` = "' . contrexx_input2db($key) . '",
`value` = "' . $serializedValue . '"
ON DUPLICATE KEY UPDATE
`value` = "' . $serializedValue . '"';
\Env::get('db')->Execute($query);
}
if (is_a($value, 'Cx\\Core\\Model\\RecursiveArrayAccess')) {
$value->parentId = intval($recursiveArrayAccess->id);
static::updateToDb($value);
}
}
}