本文整理汇总了PHP中Cx\Lib\UpdateUtil::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP UpdateUtil::sql方法的具体用法?PHP UpdateUtil::sql怎么用?PHP UpdateUtil::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Lib\UpdateUtil
的用法示例。
在下文中一共展示了UpdateUtil::sql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadsUpdate
function downloadsUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Downloads' WHERE `id` = 53");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Downloads' WHERE `area_id` = 132");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('53', 'Downloads', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Downloads' WHERE `module` = 'downloads'");
//following queries for changing the path from images/downloads into images/Downloads
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_category`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download_locale`\n SET `source` = REPLACE(`source`, 'images/downloads', 'images/Downloads')\n WHERE `source` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/downloads';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Downloads';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Downloads Updated successfully';
}
示例2: fileSharingUpdate
function fileSharingUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'FileSharing' WHERE `id` = 68");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=media&archive=FileSharing' WHERE `area_id` = 187");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('68', 'FileSharing', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'FileSharing' WHERE `module` = 'filesharing'");
//update section
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'FileSharing',`value` = 'on' WHERE\n `section` = 'filesharing' AND `name` = 'permission' AND `group` = 'config'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/filesharing';
$targetPath = ASCMS_DOCUMENT_ROOT . '/media/FileSharing';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'FileSharing updated successfully';
}
示例3: galleryUpdate
function galleryUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Gallery' WHERE `id` = 3");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Gallery' WHERE `area_id` = 12");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('3', 'Gallery', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Gallery' WHERE `module` = 'gallery'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/gallery';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Gallery';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Gallery Component Updated Successfully';
}
示例4: marketUpdates
function marketUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Market' WHERE `id` = 33");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Market' WHERE `area_id` = 98");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('33', 'Market', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Market' WHERE `module` = 'market'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$marketMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($marketMediaPath . '/market') && !file_exists($marketMediaPath . '/Market')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($marketMediaPath . '/market');
if (!\Cx\Lib\FileSystem\FileSystem::move($marketMediaPath . '/market', $marketMediaPath . '/Market')) {
return 'Failed to move the folder from ' . $marketMediaPath . '/market to ' . $marketMediaPath . '/Market.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Market updated successfully.';
}
示例5: forumUpdates
function forumUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Forum' WHERE `id` = 20");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Forum' WHERE `area_id` = 106");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('20', 'Forum', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Forum' WHERE `module` = 'forum'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$sourcePath = ASCMS_DOCUMENT_ROOT . '/media/forum';
$destinationPath = ASCMS_DOCUMENT_ROOT . '/media/Forum';
try {
if (file_exists($sourcePath) && !file_exists($destinationPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $destinationPath)) {
return 'Failed to move the folder from ' . $sourcePath . ' to ' . $destinationPath . '.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Forum updated successfully.';
}
示例6: accessUpdates
function accessUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Access' WHERE `id` = 23");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access', `module_id` = '23' WHERE `area_id` = 18");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access' WHERE `area_id` = 208");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('23', 'Access', 'core_module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Access' WHERE `module` = 'access'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Access' WHERE `section` = 'access' AND `name` = 'providers' AND `group` = 'sociallogin'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$accessImgPath = ASCMS_DOCUMENT_ROOT . '/images';
try {
if (file_exists($accessImgPath . '/access') && !file_exists($accessImgPath . '/Access')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($accessImgPath . '/access');
if (!\Cx\Lib\FileSystem\FileSystem::move($accessImgPath . '/access', $accessImgPath . '/Access')) {
return 'Failed to move the folder from ' . $accessImgPath . '/access to ' . $accessImgPath . '/Access.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Access updated successfully.';
}
示例7: calendarUpdate
function calendarUpdate()
{
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Calendar' WHERE `id` = 21");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Calendar' WHERE `area_id` = 16");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('21', 'Calendar', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Calendar' WHERE `module` = 'calendar'");
//following queries for changing the path from images/calendar into images/Calendar
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_calendar_event` SET `pic` = REPLACE(`pic`, 'images/calendar', 'images/Calendar'),\n `attach` = REPLACE(`attach`, 'images/calendar', 'images/Calendar'),\n `place_map` = REPLACE(`place_map`, 'images/calendar', 'images/Calendar')\n WHERE `pic` LIKE ('" . ASCMS_PATH_OFFSET . "/images/calendar%') ");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
$sourcePath = ASCMS_DOCUMENT_ROOT . '/images/calendar';
$targetPath = ASCMS_DOCUMENT_ROOT . '/images/Calendar';
try {
if (file_exists($sourcePath) && !file_exists($targetPath)) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath);
if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) {
return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Calendar Component Updated Successfully';
}
示例8: _downloadsUpdate
/**
* 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 _downloadsUpdate()
{
global $objDatabase, $_ARRAYLANG, $_CORELANG;
try {
\Cx\Lib\UpdateUtil::sql("UPDATE " . DBPREFIX . "module_downloads_download_locale l SET\n l.source = (SELECT source FROM " . DBPREFIX . "module_downloads_download d WHERE d.id = l.download_id),\n l.source_name = (SELECT source_name FROM " . DBPREFIX . "module_downloads_download d WHERE d.id = l.download_id);");
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file', 'after' => 'id'), 'mime_type' => array('type' => 'ENUM(\'image\',\'document\',\'pdf\',\'media\',\'archive\',\'application\',\'link\')', 'notnull' => true, 'default' => 'image', 'after' => 'type'), 'icon' => array('type' => 'ENUM(\'_blank\',\'avi\',\'bmp\',\'css\',\'doc\',\'dot\',\'exe\',\'fla\',\'gif\',\'htm\',\'html\',\'inc\',\'jpg\',\'js\',\'mp3\',\'nfo\',\'pdf\',\'php\',\'png\',\'pps\',\'ppt\',\'rar\',\'swf\',\'txt\',\'wma\',\'xls\',\'zip\')', 'notnull' => true, 'default' => '_blank', 'after' => 'source_name'), 'size' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'icon'), 'image' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'size'), 'owner_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'image'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'owner_id'), 'license' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'access_id'), 'version' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => '', 'after' => 'license'), 'author' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'version'), 'website' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'author'), 'ctime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'website'), 'mtime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'ctime'), 'is_active' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'mtime'), 'visibility' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'is_active'), 'order' => array('type' => 'INT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'visibility'), 'views' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'order'), 'download_count' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'views'), 'expiration' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'download_count'), 'validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'expiration')), array('is_active' => array('fields' => array('is_active')), 'visibility' => array('fields' => array('visibility'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download_locale', array('lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'download_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'lang_id'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'download_id'), 'source' => array('type' => 'VARCHAR(255)', 'after' => 'name'), 'source_name' => array('type' => 'VARCHAR(255)', 'after' => 'source'), 'description' => array('type' => 'text', 'after' => 'source_name')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'), 'description' => array('fields' => array('description'), 'type' => 'FULLTEXT')));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例9: _galleryUpdate
function _galleryUpdate()
{
global $objDatabase, $_ARRAYLANG;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_categories', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'pid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6)', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'comment' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'voting' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'backendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'backend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_pictures', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'catid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'validated' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'catimg' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'default' => '999'), 'size_show' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'path' => array('type' => 'TEXT', 'notnull' => true), 'link' => array('type' => 'TEXT', 'notnull' => true), 'lastedit' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0'), 'size_type' => array('type' => "SET('abs', 'proz')", 'notnull' => true, 'default' => 'proz'), 'size_proz' => array('type' => "INT(3)", 'notnull' => true, 'default' => '0'), 'size_abs_h' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'size_abs_w' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'quality' => array('type' => 'TINYINT(3)', 'notnull' => true, 'default' => '0')), array('galleryPicturesIndex' => array('type' => 'FULLTEXT', 'fields' => array('path'))));
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array('1' => array('name' => 'max_images_upload', 'value' => '10'), '2' => array('name' => 'standard_quality', 'value' => '95'), '3' => array('name' => 'standard_size_proz', 'value' => '25'), '4' => array('name' => 'standard_width_abs', 'value' => '140'), '6' => array('name' => 'standard_height_abs', 'value' => '0'), '7' => array('name' => 'standard_size_type', 'value' => 'abs'), '8' => array('name' => 'validation_show_limit', 'value' => '10'), '9' => array('name' => 'validation_standard_type', 'value' => 'all'), '11' => array('name' => 'show_names', 'value' => 'off'), '12' => array('name' => 'quality', 'value' => '95'), '13' => array('name' => 'show_comments', 'value' => 'off'), '14' => array('name' => 'show_voting', 'value' => 'off'), '15' => array('name' => 'enable_popups', 'value' => 'on'), '16' => array('name' => 'image_width', 'value' => '1200'), '17' => array('name' => 'paging', 'value' => '30'), '18' => array('name' => 'show_latest', 'value' => 'on'), '19' => array('name' => 'show_random', 'value' => 'on'), '20' => array('name' => 'header_type', 'value' => 'hierarchy'), '21' => array('name' => 'show_ext', 'value' => 'off'), '22' => array('name' => 'show_file_name', 'value' => 'on'), '23' => array('name' => 'slide_show', 'value' => 'slideshow'), '24' => array('name' => 'slide_show_seconds', 'value' => '3'));
foreach ($arrSettings as $id => $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_gallery_settings` WHERE `name`= '" . $arrSetting['name'] . "'";
if (($objRS = $objDatabase->Execute($query)) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
if ($objRS->RecordCount() == 0) {
$query = "\n INSERT INTO `" . DBPREFIX . "module_gallery_settings` (`id`, `name`, `value`)\n VALUES (" . $id . ", '" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')\n ON DUPLICATE KEY UPDATE `id` = `id`\n ";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
}
/**************************************************************************
* EXTENSION: cleanup: delete translations, comments and *
* votes of inexisting pictures *
* ADDED: Contrexx v3.0.1 *
**************************************************************************/
try {
\Cx\Lib\UpdateUtil::sql('
DELETE `language_pics`
FROM `' . DBPREFIX . 'module_gallery_language_pics` as `language_pics` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `language_pics`.`picture_id`
WHERE `pictures`.`id` IS NULL
');
\Cx\Lib\UpdateUtil::sql('
DELETE `comments`
FROM `' . DBPREFIX . 'module_gallery_comments` as `comments` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `comments`.`picid`
WHERE `pictures`.`id` IS NULL
');
\Cx\Lib\UpdateUtil::sql('
DELETE `votes`
FROM `' . DBPREFIX . 'module_gallery_votes` as `votes` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `votes`.`picid`
WHERE `pictures`.`id` IS NULL
');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
// remove the script tag at the beginning of the gallery page
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'gallery'), '/^\\s*(<script[^>]+>.+?Shadowbox.+?<\\/script>)+/sm', '', array('content'), '3.0.3');
return true;
}
示例10: ecardUpdates
function ecardUpdates()
{
//Update database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Ecard' WHERE `id` = 49");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Ecard' WHERE `area_id` = 130");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('49', 'Ecard', 'module')");
//update module name for frontend pages
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Ecard' WHERE `module` = 'ecard'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folders
$imgModulesfolderPath = ASCMS_DOCUMENT_ROOT . '/images/modules/ecard';
$mediafolderPath = ASCMS_DOCUMENT_ROOT . '/media/Ecard';
try {
if (!file_exists($mediafolderPath)) {
\Cx\Lib\FileSystem\FileSystem::make_folder($mediafolderPath);
\Cx\Lib\FileSystem\FileSystem::makeWritable($mediafolderPath);
}
//move the folder from '/images/modules/ecard/ecards_optimized' to '/media/Ecard/ecards_optimized'
if (file_exists($imgModulesfolderPath . '/ecards_optimized') && !file_exists($mediafolderPath . '/ecards_optimized')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/ecards_optimized');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/ecards_optimized', $mediafolderPath . '/ecards_optimized')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/ecards_optimized to ' . $mediafolderPath . '/ecards_optimized.';
}
}
//move the folder from '/images/modules/ecard/send_ecards' to '/media/Ecard/send_ecards'
if (file_exists($imgModulesfolderPath . '/send_ecards') && !file_exists($mediafolderPath . '/send_ecards')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/send_ecards');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/send_ecards', $mediafolderPath . '/send_ecards')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/send_ecards to ' . $mediafolderPath . '/send_ecards.';
}
}
//move the folder from '/images/modules/ecard/thumbnails' to '/media/Ecard/thumbnails'
if (file_exists($imgModulesfolderPath . '/thumbnails') && !file_exists($mediafolderPath . '/thumbnails')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/thumbnails');
if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/thumbnails', $mediafolderPath . '/thumbnails')) {
return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/thumbnails to ' . $mediafolderPath . '/thumbnails.';
}
}
return 'Successfully updated.';
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
}
示例11: _updateModules
/**
* 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 _updateModules()
{
global $objDatabase;
$arrModules = getModules();
try {
\Cx\Lib\UpdateUtil::sql('TRUNCATE TABLE `' . DBPREFIX . 'modules`');
// NOTE: scheme migration is done in core/core.php
// add modules
foreach ($arrModules as $arrModule) {
\Cx\Lib\UpdateUtil::sql("INSERT INTO " . DBPREFIX . "modules ( `id` , `name` , `description_variable` , `status` , `is_required` , `is_core` , `is_active`, `distributor` ) VALUES ( " . $arrModule['id'] . " , '" . $arrModule['name'] . "', '" . $arrModule['description_variable'] . "', '" . $arrModule['status'] . "', '" . $arrModule['is_required'] . "', '" . $arrModule['is_core'] . "', " . $arrModule['is_active'] . ", 'Comvation AG') ON DUPLICATE KEY UPDATE `id` = `id`");
}
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例12: _u2uUpdate
function _u2uUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_address_list', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'buddies_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_message_log', array('message_id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'message_text' => array('type' => 'TEXT', 'notnull' => true), 'message_title' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_sent_messages', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'message_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'receiver_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'mesage_open_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'date_time' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(50)'), 'value' => array('type' => 'TEXT')), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'name' => array('type' => 'VARCHAR(50)', 'notnull' => true), 'value' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB');
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_user_log', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_sent_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_unread_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1')), array(), 'InnoDB');
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
/******************************************************
* EXTENSION: Initial adding of the settings values *
* ADDED: Contrexx v2.1.2 *
*******************************************************/
$arrSettings = array('max_posting_size' => '2000', 'max_posting_chars' => '2000', 'wysiwyg_editor' => '1', 'subject' => 'Eine neue Nachricht von [senderName]', 'from' => 'Contrexx U2U Nachrichtensystem', 'email_message' => 'Hallo <strong>[receiverName]</strong>,<br />\\r\\n<br />\\r\\n<strong>[senderName]</strong> hat Ihnen eine private Nachricht gesendet. Um die Nachricht zu lesen, folgen Sie bitte folgendem Link:<br />\\r\\n<br />\\r\\nhttp://[domainName]/index.php?section=u2u&cmd=notification<br />\\r\\n <br />\\r\\n<br />');
foreach ($arrSettings as $name => $value) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_u2u_settings` WHERE `name` = '" . $name . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_u2u_settings` (`name`, `value`) VALUES ('" . $name . "', '" . $value . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/********************************
* EXTENSION: Timezone *
* ADDED: Contrexx v3.0.0 *
********************************/
try {
\Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_u2u_sent_messages` CHANGE `date_time` `date_time` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例13: _knowledgeUpdate
function _knowledgeUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_article_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'question' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0), 'answer' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_article_content_lang' => array('fields' => array('lang')), 'module_knowledge_article_content_article' => array('fields' => array('article'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1), 'hits' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votes' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votevalue' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'sort' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'date_created' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'date_updated' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1, 'unsigned' => true), 'parent' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'sort' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_categories_sort' => array('fields' => array('sort')), 'module_knowledge_categories_parent' => array('fields' => array('parent'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 1)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_settings', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_settings_name' => array('fields' => array('name'))));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_tags_name' => array('fields' => array('name'))));
if (strpos(\Cx\Lib\UpdateUtil::sql('SHOW CREATE TABLE `' . DBPREFIX . 'module_knowledge_tags_articles`')->fields['Create Table'], 'UNIQUE KEY') === false) {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'tag' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true)), array('module_knowledge_tags_articles_tag' => array('fields' => array('tag')), 'module_knowledge_tags_articles_article' => array('fields' => array('article'))));
}
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array(array('name' => 'max_subcategories', 'value' => '5'), array('name' => 'column_number', 'value' => '2'), array('name' => 'max_rating', 'value' => '8'), array('name' => 'best_rated_sidebar_template', 'value' => '<h2>Bestbewertete Artikel</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'best_rated_sidebar_length', 'value' => '82'), array('name' => 'best_rated_sidebar_amount', 'value' => '5'), array('name' => 'tag_cloud_sidebar_template', 'value' => '[[CLOUD]] <br style="clear: both;" />'), array('name' => 'most_read_sidebar_template', 'value' => '<h2>Bestbewertete Artikel 2</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'most_read_sidebar_length', 'value' => '79'), array('name' => 'most_read_sidebar_amount', 'value' => '5'), array('name' => 'best_rated_siderbar_template', 'value' => ''), array('name' => 'most_read_amount', 'value' => '5'), array('name' => 'best_rated_amount', 'value' => '5'));
foreach ($arrSettings as $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_knowledge_settings` WHERE `name` = '" . $arrSetting['name'] . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_knowledge_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/*******************************************
* EXTENSION: Duplicate entries clean up *
* ADDED: Contrexx v3.0.2 *
*******************************************/
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('article' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'tag' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'article')), array('article' => array('fields' => array('article', 'tag'), 'type' => 'UNIQUE', 'force' => true)), 'MyISAM');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例14: _jobsUpdate
/**
* 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 _jobsUpdate()
{
global $objDatabase;
try {
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs', array('id' => array('type' => 'INT(6)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'author' => array('type' => 'VARCHAR(150)', 'notnull' => true, 'default' => ''), 'text' => array('type' => 'MEDIUMTEXT'), 'workloc' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'workload' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'work_start' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'catid' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'userid' => array('type' => 'INT(6)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => 1), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)), array('newsindex' => array('fields' => array('title', 'text'), 'type' => 'fulltext')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_categories', array('catid' => array('type' => 'INT(2)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => ''), 'lang' => array('type' => 'INT(2)', 'default' => 1, 'unsigned' => true), 'sort_style' => array('type' => "ENUM('alpha', 'date', 'date_alpha')", 'default' => 'alpha')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_location', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => '')));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_rel_loc_jobs', array('job' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'location' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)));
\Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_settings', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(250)', 'default' => ''), 'value' => array('type' => 'TEXT', 'default' => '')));
} catch (\Cx\Lib\UpdateException $e) {
// we COULD do something else here..
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
$arrSettings = array(array('name' => 'footnote', 'value' => 'Hat Ihnen diese Bewerbung zugesagt? \\r\\nDann können Sie sich sogleich telefonisch, per E-mail oder Web Formular bewerben.'), array('name' => 'link', 'value' => 'Online für diese Stelle bewerben.'), array('name' => 'url', 'value' => 'index.php?section=contact&cmd=5&44=%URL%&43=%TITLE%'), array('name' => 'show_location_fe', 'value' => '1'));
foreach ($arrSettings as $arrSetting) {
$query = "SELECT 1 FROM `" . DBPREFIX . "module_jobs_settings` WHERE `name` = '" . $arrSetting['name'] . "'";
$objResult = $objDatabase->SelectLimit($query, 1);
if ($objResult !== false) {
if ($objResult->RecordCount() == 0) {
$query = "INSERT INTO `" . DBPREFIX . "module_jobs_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')";
if ($objDatabase->Execute($query) === false) {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
} else {
return _databaseError($query, $objDatabase->ErrorMsg());
}
}
/********************************
* EXTENSION: Timezone *
* ADDED: Contrexx v3.0.0 *
********************************/
try {
\Cx\Lib\UpdateUtil::sql('
ALTER TABLE `' . DBPREFIX . 'module_jobs`
CHANGE `startdate` `startdate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00",
CHANGE `enddate` `enddate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"
');
} catch (\Cx\Lib\UpdateException $e) {
return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
}
return true;
}
示例15: crmUpdates
function crmUpdates()
{
//Update the database changes
try {
//update module name
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Crm' WHERE `id` = 69");
//update navigation url
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=customers' WHERE `area_id` = 191");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=task' WHERE `area_id` = 192");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=deals' WHERE `area_id` = 193");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=settings' WHERE `area_id` = 195");
//Insert component entry
\Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('69', 'Crm', 'module')");
//update module name for email templates
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Crm' WHERE `section` = 'crm'");
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Crm' WHERE `section` = 'crm'");
//update module name for crm core settings
\Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Crm' WHERE `section` = 'crm'");
} catch (\Cx\Lib\UpdateException $e) {
return "Error: {$e->sql}";
}
//Update script for moving the folder
$crmImgPath = ASCMS_DOCUMENT_ROOT . '/images';
$crmMediaPath = ASCMS_DOCUMENT_ROOT . '/media';
try {
if (file_exists($crmImgPath . '/crm') && !file_exists($crmImgPath . '/Crm')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($crmImgPath . '/crm');
if (!\Cx\Lib\FileSystem\FileSystem::move($crmImgPath . '/crm', $crmImgPath . '/Crm')) {
return 'Failed to move the folder from ' . $crmImgPath . '/crm to ' . $crmImgPath . '/Crm.';
}
}
if (file_exists($crmMediaPath . '/crm') && !file_exists($crmMediaPath . '/Crm')) {
\Cx\Lib\FileSystem\FileSystem::makeWritable($crmMediaPath . '/crm');
if (!\Cx\Lib\FileSystem\FileSystem::move($crmMediaPath . '/crm', $crmMediaPath . '/Crm')) {
return 'Failed to move the folder from ' . $crmMediaPath . '/crm to ' . $crmMediaPath . '/Crm.';
}
}
} catch (\Cx\Lib\FileSystem\FileSystemException $e) {
return $e->getMessage();
}
return 'Crm updated successfully.';
}