コード例 #1
0
 public function install()
 {
     \DoctrineHelper::createSchema($this->entityManager, static::getEntities());
     $this->createLicenses();
     $temporaryUploadCollection = new CollectionEntity();
     $temporaryUploadCollection->setTitle($this->__('Temporary Upload Collection'))->setDescription($this->__('This collection is needed as temporary storage for uploaded files. Do not edit or delete!'));
     $this->entityManager->persist($temporaryUploadCollection);
     $exampleCollection = new CollectionEntity();
     $exampleCollection->setTitle($this->__('Example collection'))->setDescription($this->__('Edit or delete this example collection'));
     $this->entityManager->persist($exampleCollection);
     $this->entityManager->flush();
     if ($temporaryUploadCollection->getId() != CollectionEntity::TEMPORARY_UPLOAD_COLLECTION_ID) {
         \LogUtil::registerError($this->__('The id of the generated "temporary upload collection" must be 1, but has a different value. This should not have happened. Please report this error.'));
     }
     \HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
     \HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     $this->setVar('descriptionEscapingStrategyForCollection', 'text');
     $this->setVar('descriptionEscapingStrategyForMedia', 'text');
     $this->setVar('defaultCollectionTemplate', 'cards');
     $this->setVar('slugEditable', true);
     $this->setVar('lastNewVersionCheck', 0);
     $this->setVar('newVersionAvailable', false);
     $this->createUploadDir();
     return true;
 }
コード例 #2
0
ファイル: Installer.php プロジェクト: rmaiwald/Reviews
 /**
  * Install the Reviews application.
  *
  * @return boolean True on success, or false.
  */
 public function install()
 {
     // Check if upload directories exist and if needed create them
     try {
         $controllerHelper = new Reviews_Util_Controller($this->serviceManager);
         $controllerHelper->checkAndCreateAllUploadFolders();
     } catch (\Exception $e) {
         return LogUtil::registerError($e->getMessage());
     }
     // create all tables from according entity definitions
     try {
         DoctrineHelper::createSchema($this->entityManager, $this->listEntityClasses());
     } catch (\Exception $e) {
         if (System::isDevelopmentMode()) {
             return LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage());
         }
         $returnMessage = $this->__f('An error was encountered while creating the tables for the %s extension.', array($this->name));
         if (!System::isDevelopmentMode()) {
             $returnMessage .= ' ' . $this->__('Please enable the development mode by editing the /config/config.php file in order to reveal the error details.');
         }
         return LogUtil::registerError($returnMessage);
     }
     // set up all our vars with initial values
     $this->setVar('enablecategorization', false);
     $this->setVar('pagesize', 10);
     $this->setVar('scoreForUsers', false);
     $this->setVar('addcategorytitletopermalink', false);
     $categoryRegistryIdsPerEntity = array();
     // add default entry for category registry (property named Main)
     include_once 'modules/Reviews/lib/Reviews/Api/Base/Category.php';
     include_once 'modules/Reviews/lib/Reviews/Api/Category.php';
     $categoryApi = new Reviews_Api_Category($this->serviceManager);
     $categoryGlobal = CategoryUtil::getCategoryByPath('/__SYSTEM__/Modules/Global');
     $registryData = array();
     $registryData['modname'] = $this->name;
     $registryData['table'] = 'Review';
     $registryData['property'] = $categoryApi->getPrimaryProperty(array('ot' => 'Review'));
     $registryData['category_id'] = $categoryGlobal['id'];
     $registryData['id'] = false;
     if (!DBUtil::insertObject($registryData, 'categories_registry')) {
         LogUtil::registerError($this->__f('Error! Could not create a category registry for the %s entity.', array('review')));
     }
     $categoryRegistryIdsPerEntity['review'] = $registryData['id'];
     // create the default data
     $this->createDefaultData($categoryRegistryIdsPerEntity);
     // register persistent event handlers
     $this->registerPersistentEventHandlers();
     // register hook subscriber bundles
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     // initialisation successful
     return true;
 }
コード例 #3
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
 public function upgrade($oldversion){
     switch ($oldversion) {
         case '1.0.0':
             if (!DBUtil::createTable('cataleg_gtafEntities') ||
                 !DBUtil::createTable('cataleg_gtafGroups') ){
                 return false;
             }
         case '1.1.0':
             $gZ = ModUtil::getVar('Cataleg','grupsZikula');
             $gZ['Sirius'] = $gZ['Cataleg'];
             unset($gZ['Cataleg']);
             $gZ['ExSirius'] = $gZ['ExCataleg'];
             unset($gZ['ExCataleg']);
             $gZ['Personals'] = $gZ['Usuaris'];
             unset($gZ['Usuaris']);
             $gZ['LectorsCat'] = $gZ['Lectors'];
             unset($gZ['Lectors']);
             $gZ['EditorsCat'] = $gZ['Editors'];
             unset($gZ['Editors']);
             ModUtil::setVar('Cataleg','grupsZikula',$gZ);
             $var2 = ModUtil::getVar('Cataleg', 'usuarisCataleg');
             if (isset($var2)) ModUtil::delVar('Cataleg', 'usuarisCataleg');
             
         case '1.1.1':
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
         case '1.1.2':
         case '1.1.3':
     }
     return true;
 }
コード例 #4
0
ファイル: Installer.php プロジェクト: rmaiwald/Reviews
 /**
  * upgrade
  */
 public function upgrade($oldversion)
 {
     // Upgrade dependent on old version number
     switch ($oldversion) {
         case '2.4':
             $prefix = $this->serviceManager['prefix'];
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             $sql = 'RENAME TABLE ' . $prefix . '_' . 'reviews' . ' TO ' . 'reviews';
             $stmt = $connection->prepare($sql);
             try {
                 $stmt->execute();
             } catch (Exception $e) {
                 LogUtil::registerError($e);
             }
         case '2.4.1':
             try {
                 DoctrineHelper::updateSchema($this->entityManager, $this->listEntityClasses());
             } catch (\Exception $e) {
                 if (System::isDevelopmentMode()) {
                     LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage());
                 }
                 return LogUtil::registerError($this->__f('An error was encountered while dropping the tables for the %s extension.', array($this->getName())));
             }
             $repository = $this->getEntityManager()->getRepository('Reviews_Entity_Review');
             // we get all old entries
             $result = DBUtil::executeSQL('SELECT * FROM `reviews`');
             $reviews = $result->fetchAll(Doctrine::FETCH_ASSOC);
             $dom = ZLanguage::getModuleDomain($this->name);
             $workflowHelper = new Zikula_Workflow('standard', 'Reviews');
             // we get serviceManager
             $serviceManager = ServiceUtil::getManager();
             // we get entityManager
             $entityManager = $serviceManager->getService('doctrine.entitymanager');
             if (count($reviews) > 0) {
                 foreach ($reviews as $key => $review) {
                     $newReview = new Reviews_Entity_Review();
                     $newReview->setWorkflowState('approved');
                     $newReview->setTitle($review['pn_title']);
                     $newReview->setText($review['pn_text']);
                     if ($review['pn_reviewer'] != '') {
                         $newReview->setReviewer($review['pn_reviewer']);
                     } else {
                         $newReview->setReviewer(__('Unknown', $dom));
                     }
                     if ($review['pn_email'] != '') {
                         $newReview->setEmail($review['pn_email']);
                     } else {
                         $adminmail = UserUtil::getVar('email', 2);
                         $newReview->setEmail(__($adminmail));
                     }
                     $newReview->setScore($review['pn_score']);
                     $newReview->setCover($review['pn_cover']);
                     $newReview->setUrl($review['pn_url']);
                     $newReview->setUrl_title($review['pn_url_title']);
                     $newReview->setHits($review['pn_hits']);
                     $newReview->setZlanguage($review['pn_language']);
                     $createdDate = new Datetime($review['pn_cr_date']);
                     $newReview->setCreatedDate($createdDate);
                     $updatedDate = new DateTime($review['pn_lu_date']);
                     $newReview->setUpdatedDate($updatedDate);
                     $newReview->setCreatedUserId($review['pn_cr_uid']);
                     $newReview->setUpdatedUserId($review['pn_lu_uid']);
                     $entityManager->persist($newReview);
                     $entityManager->flush();
                 }
             }
             $result2 = DBUtil::executeSQL('SELECT * FROM `reviews_review`');
             $reviews2 = $result2->fetchAll(Doctrine::FETCH_ASSOC);
             // we set the workflow
             foreach ($reviews2 as $key => $review2) {
                 $obj['__WORKFLOW__']['obj_table'] = 'review';
                 $obj['__WORKFLOW__']['obj_idcolumn'] = 'id';
                 $obj['id'] = $review2['id'];
                 $workflowHelper->registerWorkflow($obj, 'approved');
             }
             // move relations from categories_mapobj to reviews_category
             // then delete old data
             $connection = $this->entityManager->getConnection();
             $sqls = array();
             $sqls[] = "INSERT INTO reviews_review_category (entityId, registryId, categoryId) SELECT obj_id, reg_id, category_id FROM categories_mapobj WHERE modname = 'Reviews' AND tablename = 'reviews'";
             $sqls[] = "DELETE FROM categories_mapobj WHERE modname = 'Reviews' AND tablename = 'reviews'";
             // update category registry data to change tablename to EntityName
             $sqls[] = "UPDATE categories_registry SET tablename = 'Review' WHERE tablename = 'reviews'";
             // do changes
             foreach ($sqls as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                     LogUtil::registerError($e->getMessage());
                 }
             }
             $pagesize = $this->getVar('itemsperpage');
             $this->setVar('pagesize', $pagesize);
             $this->delVar('itemsperpage');
             $this->setVar('scoreForUsers', false);
             $addcategorytitletopermalink = $this->getVar('addcategorytitletopermalink');
             $this->setVar('addcategorytitletopermalink');
             // register persistent event handlers
             $this->registerPersistentEventHandlers();
             // register hook subscriber bundles
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
             DBUtil::dropTable('reviews');
         case '2.5.0':
             // later upgrades
     }
     // upgrade successful
     return true;
 }
コード例 #5
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Update the IWmessages module
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    public function upgrade($oldversion) {

		switch ($oldversion) {
			case($oldversion < '3.0.0'):
        		//Array of names
        		$oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWmessages'", '', false, '');
        		$newVarsNames = Array('groupsCanUpdate', 'uploadFolder', 'multiMail', 'limitInBox',
            		'limitOutBox', 'dissableSuggest', 'smiliesActive');
        		$newVars = Array('groupsCanUpdate' => '$',
            		'uploadFolder' => 'messages',
            		'multiMail' => '$',
            		'limitInBox' => '50',
            		'limitOutBox' => '50',
            		'dissableSuggest' => '0',
            		'smiliesActive' => '1');
        		// Delete unneeded vars
        		$del = array_diff($oldVarsNames, $newVarsNames);
        		foreach ($del as $i) {
            		$this->delVar($i);
        		}
        		// Add new vars
        		$add = array_diff($newVarsNames, $oldVarsNames);
        		foreach ($add as $i) {
            		$this->setVar($i, $newVars[$i]);
        		}

			case '3.0.0':
				HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
			case '3.0.1':
		}
        return true;
    }
コード例 #6
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Update the IWnoteboard module
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    public function upgrade($oldversion) {

	switch ($oldversion) {
		case($oldversion < '3.0.0'):
        // Delete unneded columns
        $c = array();
        $c[] = "ALTER TABLE `IWnoteboard` DROP `iw_public` ";
        $c[] = "ALTER TABLE `IWnoteboard` DROP `iw_sharedFrom` ";
        $c[] = "ALTER TABLE `IWnoteboard` DROP `iw_sharedId` ";
        foreach ($c as $sql) {
            DBUtil::executeSQL($sql);
        }

        // Update z_blocs table
        $c = "UPDATE blocks SET bkey = 'Nbheadlines' WHERE bkey = 'nbheadlines'";
        if (!DBUtil::executeSQL($c)) {
            return false;
        }

        $c = "UPDATE blocks SET bkey = 'Nbtopics' WHERE bkey = 'nbtopics'";
        if (!DBUtil::executeSQL($c)) {
            return false;
        }

        //Array de noms
        $oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWnoteboard'", '', false, '');


        $newVarsNames = Array('grups', 'permisos', 'marcat', 'verifica', 'caducitat', 'repperdefecte', 'colorrow1',
            'colorrow2', 'colornewrow1', 'colornewrow2', 'attached', 'notRegisteredSeeRedactors', 'multiLanguage',
            'topicsSystem', 'shipHeadersLines', 'notifyNewEntriesByMail', 'editPrintAfter',
            'notifyNewCommentsByMail', 'commentCheckedByDefault', 'smallAvatars');

        $newVars = Array('grups' => '',
            'permisos' => '',
            'marcat' => '',
            'verifica' => '',
            'caducitat' => '30',
            'repperdefecte' => '1',
            'colorrow1' => '#FFFFFF',
            'colorrow2' => '#FFFFCC',
            'colornewrow1' => '#FFCC99',
            'colornewrow2' => '#99FFFF',
            'attached' => 'noteboard',
            'notRegisteredSeeRedactors' => '1',
            'multiLanguage' => '0',
            'topicsSystem' => '0',
            'shipHeadersLines' => '0',
            'notifyNewEntriesByMail' => '0',
            'editPrintAfter' => '-1',
            'notifyNewCommentsByMail' => '1',
            'commentCheckedByDefault' => '1',
            'smallAvatars' => '0');

        // Delete unneeded vars
        $del = array_diff($oldVarsNames, $newVarsNames);
        foreach ($del as $i) {
            $this->delVar($i);
        }

        // Add new vars
        $add = array_diff($newVarsNames, $oldVarsNames);
        foreach ($add as $i) {
            $this->setVar($i, $newVars[$i]);
        }
		case '3.0.0':
			HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
		case '3.0.1':
        return true;
	}
    }
コード例 #7
0
ファイル: Installer.php プロジェクト: nmpetkov/AddressBook
 function upgrade($oldversion)
 {
     $prefix = System::getVar('prefix');
     $prefix = $prefix ? $prefix . '_' : '';
     switch ($oldversion) {
         case '1.0':
             $sql = "ALTER TABLE " . $prefix . "addressbook_address ADD adr_geodata VARCHAR( 180 ) NULL AFTER adr_country";
             if (!DBUtil::executeSQL($sql, -1, -1, false, true)) {
                 return false;
             }
             // Upgrade successfull
             ModUtil::setVar('Addressbook', 'google_api_key', '');
             ModUtil::setVar('Addressbook', 'google_zoom', 15);
             return AddressBook_upgrade(1.1);
         case '1.1':
             $this->_addressbook_migratecategories();
             $this->_addressbook_migrateprefixes();
             ModUtil::delVar('Addressbook', 'name_order');
             ModUtil::delVar('Addressbook', 'zipbeforecity');
             return AddressBook_upgrade(1.2);
         case '1.2':
             ModUtil::delVar('Addressbook', 'textareawidth');
             ModUtil::delVar('Addressbook', 'dateformat');
             ModUtil::delVar('Addressbook', 'numformat');
             $this->_addressbook_upgradeto_1_3();
             return true;
         case '1.3':
         case '1.3.1':
             // drop table prefix
             if ($prefix) {
                 $connection = Doctrine_Manager::getInstance()->getConnection('default');
                 $sqlStatements = array();
                 $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_address' . " TO `addressbook_address`";
                 $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_customfields' . " TO `addressbook_customfields`";
                 $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_favourites' . " TO `addressbook_favourites`";
                 $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_labels' . " TO `addressbook_labels`";
                 foreach ($sqlStatements as $sql) {
                     $stmt = $connection->prepare($sql);
                     try {
                         $stmt->execute();
                     } catch (Exception $e) {
                     }
                 }
             }
         case '1.3.2':
             // Register hooks
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="AddressBook"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="AddressBook"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
         case '1.3.3':
             // Register event handlers
             if (ModUtil::available('Content')) {
                 Content_Installer::updateContentType('AddressBook');
             }
             EventUtil::registerPersistentModuleHandler('AddressBook', 'module.content.gettypes', array('AddressBook_EventHandler_Listeners', 'getContentTypes'));
             // default images directory and manager
             $this->setVar('images_dir', 'userdata/Addressbook');
             $this->setVar('images_manager', 'kcfinder');
         case '1.3.4':
             // Add language and status column
             DBUtil::changeTable('addressbook_address');
             // Assume language of created records is "All". Status set to active.
             $objArray = array('language' => '', 'status' => 1);
             DBUtil::updateObject($objArray, 'addressbook_address', 'WHERE 1');
             // Delete unused settings
             ModUtil::delVar('Addressbook', 'special_chars_1');
             ModUtil::delVar('Addressbook', 'special_chars_2');
             // Register new settings
             $this->setVar('addressbooktype', 1);
             // 1-people, 2-companies
             $this->setVar('showabcfilter', 1);
         case '1.3.5':
             // Register new settings
             $this->setVar('allowprivate', 0);
             return true;
         case '1.3.6':
             return true;
     }
 }
コード例 #8
0
ファイル: Installer.php プロジェクト: nmpetkov/Zgoodies
 /**
  * Initializes a new install
  *
  * @return  boolean    true/false
  */
 public function install()
 {
     // Register for hooks subscribing
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     return true;
 }
コード例 #9
0
ファイル: Installer.php プロジェクト: nmpetkov/Quotes
 /**
  * Upgrade quotes module
  * @author The Zikula Development Team
  * @return true if init successful, false otherwise
  */
 public function upgrade($oldversion)
 {
     // upgrade dependent on old version number
     switch ($oldversion) {
         case '1.3':
             // version 1.3 was shipped with .72x/.75
             ModUtil::setVar('Quotes', 'itemsperpage', 25);
             // we don't need these variables anymore
             ModUtil::delVar('Quotes', 'detail');
             ModUtil::delVar('Quotes', 'table');
         case '1.5':
             // version 1.5 was shipped with .76x
             // migrate the quotes into the default category
             if (!$this->_migratecategories()) {
                 return LogUtil::registerError($this->__('Error! Update attempt failed.'));
             }
         case '2.0':
             // remove the mapcatcount variable
             ModUtil::delVar('Quotes', 'catmapcount');
         case '2.1':
             // add the categorization variable
             ModUtil::setVar('Quotes', 'enablecategorization', true);
         case '2.2':
         case '2.3':
         case '2.5':
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             // drop table prefix
             $prefix = $this->serviceManager['prefix'];
             $sqlQueries = array();
             $sqlQueries[] = 'RENAME TABLE ' . $prefix . '_quotes' . " TO `quotes`";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_qid` `qid` INT(11) NOT NULL AUTO_INCREMENT";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_quote` `quote` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_author` `author` VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A'";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_status` `status` TINYINT(4) NULL DEFAULT '1'";
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             // update table structure according to table definition
             if (!DBUtil::changeTable('quotes')) {
                 return "2.5";
             }
         case '3.0.0':
             // Register hooks
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="Quotes"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="Quotes"';
             $sqlQueries[] = 'DELETE FROM `hook_provider` WHERE `owner`="Quotes"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
             HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
         case '3.1.0':
             ModUtil::setVar('Quotes', 'enablefacebookshare', false);
         case '3.1.1':
             // future upgrade routines
     }
     // upgrade success
     return true;
 }
コード例 #10
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Upgrade the users module from an older version.
     *
     * This function must consider all the released versions of the module!
     * If the upgrade fails at some point, it returns the last upgraded version.
     *
     * @param string $oldVersion Version number string to upgrade from.
     *
     * @return mixed True on success, last valid version string or false if fails.
     */
    public function upgrade($oldVersion)
    {
        // $oldversion 1.9 and 1.10 handled by Zikula 1.2.
        if (version_compare($oldVersion, '1.11') === -1) {
            return $oldVersion;
        }
        // Versions 1.14 through 2.1.0 were development versions that were released only to developers, and many changes
        // over the course of those versions regarding database structure were radically modified. Upgrading from any of
        // those versions is not possible.
        if ((version_compare($oldVersion, '1.13') === 1) && (version_compare($oldVersion, '2.2.0') === -1)) {
            return $oldVersion;
        }

        // Upgrade dependent on old version number
        switch ($oldVersion) {
            case '1.11':
                // upgrade 1.11 to 1.12
                $this->upgrade_migrateSerialisedUserTemp();
            case '1.12':
                // upgrade 1.12 to 1.13

                // Do modvar renames and moves here, but new modvars and modvar removals are done below for all versions
                $this->setVar(Users_Constant::MODVAR_AVATAR_IMAGE_PATH, Users_Constant::MODVAR_AVATAR_IMAGE_PATH);
                // lowercaseuname Removed in 2.0.0
                //$this->setVar('lowercaseuname', 1);

                // **************************************************************
                // 1.12->1.13 is the last known upgrade of Users for Zikula 1.2.x
                // Users module 1.13 is the last known 1.2.x version released.
                // If the 1.2.x branch gets a new version, this must be updated.
                // **************************************************************
            case '1.13':
                // upgrade 1.13 to 2.2.0

                // Do modvar renames and moves here, but new modvars and modvar removals are done below for all versions

                // Check if the hash method is md5. If so, it is not used any more. Change it to the new default.
                if ($this->getVar(Users_Constant::MODVAR_HASH_METHOD, false) == 'md5') {
                    $this->setVar(Users_Constant::MODVAR_HASH_METHOD, Users_Constant::DEFAULT_HASH_METHOD);
                }

                // Convert the banned user names to a comma separated list.
                $bannedUnames = $this->getVar(Users_Constant::MODVAR_REGISTRATION_ILLEGAL_UNAMES, '');
                $bannedUnames = preg_split('/\s+/', $bannedUnames);
                $bannedUnames = implode(', ', $bannedUnames);
                $this->setVar(Users_Constant::MODVAR_REGISTRATION_ILLEGAL_UNAMES, $bannedUnames);

                // System-generated passwords are deprecated since 1.3.0. Change it to
                // User-generated passwords.
                $regVerifyEmail = $this->getVar(Users_Constant::MODVAR_REGISTRATION_VERIFICATION_MODE, Users_Constant::VERIFY_NO);
                if ($regVerifyEmail == Users_Constant::VERIFY_SYSTEMPWD) {
                    $this->setVar(Users_Constant::MODVAR_REGISTRATION_VERIFICATION_MODE, Users_Constant::VERIFY_USERPWD);
                }

                // IDN domains setting moving to system settings.
                System::setVar('idnnames', (bool)$this->getVar('idnnames', true));

                // Minimum age is moving to Legal
                ModUtil::setVar('Legal', 'minimumAge', $this->getVar('minage', 0));

                if (!$this->upgrade113XTablesTo220Tables($oldVersion)) {
                    return '1.13';
                }

                EventUtil::registerPersistentModuleHandler($this->name, 'get.pending_content', array('Users_Listener_PendingContent', 'pendingContentListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'user.login.veto', array('Users_Listener_ForcedPasswordChange', 'forcedPasswordChangeListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'user.logout.succeeded', array('Users_Listener_ClearUsersNamespace', 'clearUsersNamespaceListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'frontcontroller.exception', array('Users_Listener_ClearUsersNamespace', 'clearUsersNamespaceListener'));
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
                HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
            case '2.2.0':
                // This s the current version: add 2.2.0 --> next when appropriate
        }

        $currentModVars = $this->getVars();
        $defaultModVars = $this->getDefaultModvars();

        // Remove modvars that are no longer defined.
        foreach ($currentModVars as $modVar => $currentValue) {
            if (!array_key_exists($modVar, $defaultModVars)) {
                $this->delVar($modVar);
            }
        }

        // Add modvars that are new to the version
        foreach ($defaultModVars as $modVar => $defaultValue) {
            if (!array_key_exists($modVar, $currentModVars)) {
                $this->setVar($modVar, $defaultValue);
            }
        }

        // Update successful
        return true;
    }
コード例 #11
0
ファイル: Installer.php プロジェクト: nmpetkov/ZphpBB2
 /**
  * Upgrade module
  *
  * @param   string    $oldversion
  * @return  boolean   true/false
  */
 public function upgrade($oldversion)
 {
     // upgrade dependent on old version number
     switch ($oldversion) {
         case '2.0':
             $table_prefix = 'phpbb_';
             $this->setVar('table_prefix', $table_prefix);
             $connection = Doctrine_Manager::getInstance()->getCurrentConnection();
             // drop system table prefix (depreciated)
             $stmt = $connection->prepare("SHOW TABLES LIKE '%" . $table_prefix . "_%'");
             try {
                 $stmt->execute();
             } catch (Exception $e) {
                 return LogUtil::registerError(__('Error: ') . $e->getMessage());
             }
             $items = $stmt->fetchAll(Doctrine_Core::FETCH_NUM);
             foreach ($items as $item) {
                 $pos = strpos($item[0], $table_prefix);
                 if ($pos > 0) {
                     $stmt = $connection->prepare('RENAME TABLE ' . $item[0] . " TO " . substr($item[0], $pos));
                     try {
                         $stmt->execute();
                     } catch (Exception $e) {
                         return LogUtil::registerError(__('Error: ') . $e->getMessage());
                     }
                 }
             }
             // Register hooks
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="ZphpBB2"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="ZphpBB2"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
         case '2.1.0':
             // Register event handlers
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.create', array('ZphpBB2_Listener_UsersSynch', 'createAccountListener'));
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.update', array('ZphpBB2_Listener_UsersSynch', 'updateAccountListener'));
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.delete', array('ZphpBB2_Listener_UsersSynch', 'deleteAccountListener'));
         case '2.1.1':
             // future upgrade routines
     }
     return true;
 }
コード例 #12
0
ファイル: Installer.php プロジェクト: robbrandt/Content
 protected function contentUpgrade_4_1_0($oldVersion)
 {
     // re-install hooks
     // all hooks that are available in 4.1.0 need to be unregistrered, otherwise re-registration will occur
     // unregister ui_hooks.pages
     $bundle = new Zikula_HookManager_SubscriberBundle($this->name, 'subscriber.content.ui_hooks.pages', 'ui_hooks', $this->__('Content Display Hooks'));
     $bundle->addEvent('display_view', 'content.ui_hooks.pages.display_view');
     $bundle->addEvent('form_edit', 'content.ui_hooks.pages.form_edit');
     $bundle->addEvent('form_delete', 'content.ui_hooks.pages.form_delete');
     $bundle->addEvent('validate_edit', 'content.ui_hooks.pages.validate_edit');
     $bundle->addEvent('validate_delete', 'content.ui_hooks.pages.validate_delete');
     $bundle->addEvent('process_edit', 'content.ui_hooks.pages.process_edit');
     $bundle->addEvent('process_delete', 'content.ui_hooks.pages.process_delete');
     $oldBundles['subscriber.content.ui_hooks.pages'] = $bundle;
     // unregister filter_hooks.pages
     $bundle = new Zikula_HookManager_SubscriberBundle($this->name, 'subscriber.content.filter_hooks.pages', 'filter_hooks', $this->__('Content Filter Hooks'));
     $bundle->addEvent('filter', 'content.filter_hooks.pages.filter');
     $oldBundles['subscriber.content.filter_hooks.pages'] = $bundle;
     // unregister ui hooks for html contenttype
     $bundle = new Zikula_HookManager_SubscriberBundle($this->name, 'subscriber.content.ui_hooks.htmlcontenttype', 'ui_hooks', $this->__('HTML ContentType Hook'));
     $bundle->addEvent('display_view', 'content.ui_hooks.htmlcontenttype.display_view');
     $bundle->addEvent('form_edit', 'content.ui_hooks.htmlcontenttype.form_edit');
     $bundle->addEvent('form_delete', 'content.ui_hooks.htmlcontenttype.form_delete');
     $bundle->addEvent('validate_edit', 'content.ui_hooks.htmlcontenttype.validate_edit');
     $bundle->addEvent('validate_delete', 'content.ui_hooks.htmlcontenttype.validate_delete');
     $bundle->addEvent('process_edit', 'content.ui_hooks.htmlcontenttype.process_edit');
     $bundle->addEvent('process_delete', 'content.ui_hooks.htmlcontenttype.process_delete');
     $oldBundles['subscriber.content.ui_hooks.htmlcontenttype'] = $bundle;
     // unregister the filter_hooks.htmlcontenttype
     $bundle = new Zikula_HookManager_SubscriberBundle($this->name, 'subscriber.content.filter_hooks.htmlcontenttype', 'filter_hooks', $this->__('HTML ContentType Filter Hook'));
     $bundle->addEvent('filter', 'content.filter_hooks.htmlcontenttype.filter');
     $oldBundles['subscriber.content.filter_hooks.htmlcontenttype'] = $bundle;
     HookUtil::unregisterSubscriberBundles($oldBundles);
     // Re-register hooks
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     LogUtil::registerStatus($this->__('All old hooks have been unregistered and new available hooks are now registrered.'));
     // add new variable(s)
     $this->setVar('pageinfoLocation', 'top');
     $this->setVar('overrideTitle', true);
     return true;
 }
コード例 #13
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Update the IWforums module
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
     * @author Josep Ferràndiz Farré (jferran6@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    public function upgrade($oldversion) {
         switch (true) {
            case ($oldversion < '3.0.0'):
                //ADD new fields to tables
                $c = "ALTER TABLE `IWforums_msg` ADD `iw_onTop` TINYINT (4) NOT NULL DEFAULT '0'";
                if (!DBUtil::executeSQL($c)) {
                    return false;
                }

                //Array de noms
                $oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWforums'", '', false, '');

                $newVarsNames = Array('urladjunts', 'avatarsVisible', 'smiliesActive');

                $newVars = Array('urladjunts' => 'forums',
                    'avatarsVisible' => 1,
                    'smiliesActive' => 1);

                // Delete unneeded vars
                $del = array_diff($oldVarsNames, $newVarsNames);
                foreach ($del as $i) {
                    $this->delVar($i);
                }

                // Add new vars
                $add = array_diff($newVarsNames, $oldVarsNames);
                foreach ($add as $i) {
                    $this->setVar($i, $newVars[$i]);
                }
                
            case ($oldversion == '3.0.0'):                
                $sql = "ALTER TABLE `IWforums_definition` ADD `longDescriu` LONGTEXT NOT NULL Default ''";
                $connection = Doctrine_Manager::getInstance()->getConnection('default');
                $stmt = $connection->prepare($sql);
                try {
                    $stmt->execute();
                } catch (Exception $e) {
                    LogUtil::registerError($e->getMessage());
                    return false;
                }   
                $this->setVar('restyledTheme', '1');
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
                
            case ($oldversion == '3.0.1'):                
                $connection = $this->entityManager->getConnection();
                $sqlStatements = array();
                $sqlStatements[] = "ALTER TABLE `IWforums_definition` ADD `subscriptionMode` TINYINT(4) DEFAULT '1'";
                $sqlStatements[] = "ALTER TABLE `IWforums_definition` ADD `subscribers` LONGTEXT";
                $sqlStatements[] = "ALTER TABLE `IWforums_definition` ADD `noSubscribers` LONGTEXT";
                foreach ($sqlStatements as $sql) {
                    $stmt = $connection->prepare($sql);
                    try {
                        $stmt->execute();
                    } catch (Exception $e) {
                        
                    }
                }                
            }
        return true;
    }
コード例 #14
0
ファイル: Installer.php プロジェクト: rmaiwald/EZComments
 /**
  * upgrade the EZComments module from an old version
  *
  * This function upgrades the module to be used. It updates tables,
  * registers hooks,...
  *
  * @return boolean true on success, false otherwise.
  */
 public function upgrade($oldversion)
 {
     switch ($oldversion) {
         case '1.2':
             $this->setVar('enablepager', false);
             $this->setVar('commentsperpage', '25');
         case '1.3':
             $this->setVar('blacklinkcount', 5);
             $this->setVar('akismet', false);
         case '1.4':
             $this->setVar('anonusersrequirename', false);
             $this->setVar('akismetstatus', 1);
         case '1.5':
             if (!DBUtil::changeTable('EZComments')) {
                 return '1.5';
             }
             $this->setVar('template', 'Standard');
             $this->setVar('modifyowntime', 6);
             $this->setVar('useaccountpage', '1');
         case '1.6':
         case '1.61':
         case '1.62':
             $this->setVar('migrated', array('dummy' => true));
             $this->setVar('css', 'style.css');
         case '2.0.0':
         case '2.0.1':
             // register hooks
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
             HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
             // register the module delete hook
             EventUtil::registerPersistentModuleHandler('EZComments', 'installer.module.uninstalled', array('EZComments_EventHandlers', 'moduleDelete'));
             EventUtil::registerPersistentModuleHandler('EZComments', 'installer.subscriberarea.uninstalled', array('EZComments_EventHandlers', 'hookAreaDelete'));
             // drop table prefix
             $prefix = $this->serviceManager['prefix'];
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             $sql = 'RENAME TABLE ' . $prefix . '_ezcomments' . " TO ezcomments";
             $stmt = $connection->prepare($sql);
             try {
                 $stmt->execute();
             } catch (Exception $e) {
             }
             if (!DBUtil::changeTable('EZComments')) {
                 return LogUtil::registerError($this->__('Error updating the table.'));
             }
         case '3.0.0':
         case '3.0.1':
             // future upgrade routines
             break;
     }
     return true;
 }
コード例 #15
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Upgrade the errors module from an old version
     *
     * This function must consider all the released versions of the module!
     * If the upgrade fails at some point, it returns the last upgraded version.
     *
     * @param string $oldversion Version number string to upgrade from.
     *
     * @return mixed True on success, last valid version string or false if fails.
     */
    public function upgrade($oldversion)
    {
        // rename table if upgrading from an earlier version
        if (in_array(DBUtil::getLimitedTablename('seccont'), DBUtil::MetaTables())) {
            DBUtil::renameTable('seccont', 'pages');
            DBUtil::renameColumn('pages', 'pn_artid', 'pageid');
        }

        switch ($oldversion)
        {
            // 1.0 shipped with .7x
            case '1.0':
            // populate permalinks for existing content
                $tables = DBUtil::getTables();
                $shorturlsep = System::getVar('shorturlsseparator');
                $sqls   = array();
                $sqls[] = "UPDATE $tables[pages] SET pn_urltitle = REPLACE(pn_title, ' ', '{$shorturlsep}')";
                $sqls[] = "UPDATE $tables[pages] SET pn_cr_date = '".DateUtil::getDatetime()."'";
                $sqls[] = "UPDATE $tables[pages] SET pn_displaywrapper = 0";
                foreach ($sqls as $sql) {
                    if (!DBUtil::executeSQL($sql)) {
                        return LogUtil::registerError($this->__('Error! Update attempt failed.'));
                    }
                }
                $this->setVar('itemsperpage', 25);

            case '2.0':
            case '2.1':
                $this->setVar('enablecategorization', true);
                $this->setVar('addcategorytitletopermalink', true);
                ModUtil::dbInfoLoad('Pages', 'Pages', true);
                if (!$this->_migratecategories()) {
                    LogUtil::registerError($this->__('Error! Update attempt failed.'));
                    return '2.1';
                }

            case '2.2':
                if (!$this->_migratedisplayvars()) {
                    LogUtil::registerError($this->__('Error! Update attempt failed.'));
                    return '2.2';
                }

            // gettext conversion
            case '2.3':
                $this->setVar('showpermalinkinput', true);
                if (!$this->_migrategtlanguage()) {
                    LogUtil::registerError($this->__('Error! Update attempt failed.'));
                    return '2.3';
                }

            case '2.4':
            case '2.4.1':
            case '2.4.2':
                $prefix = $this->serviceManager['prefix'];
                $connection = Doctrine_Manager::getInstance()->getConnection('default');
                $sqlStatements = array();
                // N.B. statements generated with PHPMyAdmin
                $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_pages' . " TO `pages`";
                $sqlStatements[] = "ALTER TABLE `pages` 
CHANGE `pn_pageid` `pageid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
CHANGE `pn_title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_counter` `counter` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_language` `language` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CHANGE `pn_urltitle` `urltitle` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_displaywrapper` `displaywrapper` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_displaytitle` `displaytitle` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_displaycreated` `displaycreated` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_displayupdated` `displayupdated` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_displaytextinfo` `displaytextinfo` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_displayprint` `displayprint` TINYINT( 4 ) NOT NULL DEFAULT '1',
CHANGE `pn_obj_status` `obj_status` CHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A',
CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
CHANGE `pn_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
CHANGE `pn_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0'";
                foreach ($sqlStatements as $sql) {
                    $stmt = $connection->prepare($sql);
                    try {
                        $stmt->execute();
                    } catch (Exception $e) {
                    }   
                }
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
                // set defaults for modvars that should have been set in 2.2 upgrade
                $this->resetModVars();
                // update table
                if (!DBUtil::changeTable('pages')) {
                    return '2.4.2';
                }
            // further upgrade routines
        }

        // Update successful
        return true;
    }
コード例 #16
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * Update the IWforms module
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    public function upgrade($oldversion) {

        switch ($oldversion) {
            case ($oldversion < '3.0.0'):
                //ADD new fields to tables
                $c1 = "ALTER TABLE `IWforms_definition` ADD `iw_returnURL` VARCHAR (150) NOT NULL";
                if (!DBUtil::executeSQL($c1)) {
                    return false;
                }

                $c2 = "ALTER TABLE `IWforms_definition` ADD `iw_filesFolder` VARCHAR (25) NOT NULL";
                if (!DBUtil::executeSQL($c2)) {
                    return false;
                }

                $c3 = "ALTER TABLE `IWforms_definition` ADD `iw_lang` VARCHAR (2) NOT NULL DEFAULT ''";
                if (!DBUtil::executeSQL($c3)) {
                    return false;
                }

                // Update z_blocs table
                $c4 = "UPDATE blocks SET bkey = 'Formnote' WHERE bkey = 'formnote'";
                if (!DBUtil::executeSQL($c4)) {
                    return false;
                }

                $c5 = "UPDATE blocks SET bkey = 'Formslist' WHERE bkey = 'formslist'";
                if (!DBUtil::executeSQL($c5)) {
                    return false;
                }

                // serialize bloc Formslist content
                $where = "bkey='Formslist'";
                $items = DBUtil::selectObjectArray('blocks', $where, '', '-1', '-1');
                foreach ($items as $item) {
                    $valuesArray = explode('---', $item['url']);
                    $categories = $valuesArray[0];
                    $listBox = $valuesArray[1];
                    $serialized = serialize(array('categories' => $categories,
                        'listBox' => $listBox));
                    $c = "UPDATE blocks SET content = '$serialized', url='' WHERE bid = $item[bid]";
                    if (!DBUtil::executeSQL($c)) {
                        return false;
                    }
                }

                //Array de noms
                $oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWforms'", '', false, '');

                $newVarsNames = Array('characters', 'resumeview', 'newsColor', 'viewedColor', 'completedColor',
                    'validatedColor', 'fieldsColor', 'contentColor', 'attached', 'publicFolder');

                $newVars = Array('characters' => '15',
                    'resumeview' => '0',
                    'newsColor' => '#90EE90',
                    'viewedColor' => '#FFFFFF',
                    'completedColor' => '#D3D3D3',
                    'validatedColor' => '#CC9999',
                    'fieldsColor' => '#ADD8E6',
                    'contentColor' => '#FFFFE0',
                    'attached' => 'forms',
                    'publicFolder' => 'forms/public');

                // Delete unneeded vars
                $del = array_diff($oldVarsNames, $newVarsNames);
                foreach ($del as $i) {
                    $this->delVar($i);
                }

                // Add new vars
                $add = array_diff($newVarsNames, $oldVarsNames);
                foreach ($add as $i) {
                    $this->setVar($i, $newVars[$i]);
                }
            case '3.0.0':
                DBUtil::changeTable('IWforms_definition');
			case '3.0.1':
				//Implement Scribite Hooks
				HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
				//Templates to tpl
				$commands = array();
				$commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinFormTemplate SET DEFAULT 'IWforms_user_new.tpl'";
				$commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinTemplate SET DEFAULT 'IWforms_user_read.tpl'";
				$commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinNoteTemplate SET DEFAULT 'IWforms_user_read.tpl'";
				// Load DB connection
				$dbEvent = new Zikula_Event('doctrine.init_connection');
				$connection = $this->eventManager->notify($dbEvent)->getData();
				foreach ($commands as $sql) {
    				$stmt = $connection->prepare($sql);
    				$stmt->execute();
				}
			case '3.0.2':
        }

        return true;
    }
コード例 #17
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * upgrade the module from an old version
     *
     * This function must consider all the released versions of the module!
     * If the upgrade fails at some point, it returns the last upgraded version.
     *
     * @param  string $oldVersion version number string to upgrade from
     * @return mixed  true on success, last valid version string or false if fails
     */
    public function upgrade($oldversion)
    {
        // Upgrade dependent on old version number
        switch ($oldversion) {
            case '3.6':
                // Rename 'thelang' block.
                $table = 'blocks';
                $sql = "UPDATE $table SET bkey = 'lang' WHERE bkey = 'thelang'";
                DBUtil::executeSQL($sql);
                // Optional upgrade
                if (in_array(DBUtil::getLimitedTablename('message'), DBUtil::metaTables())) {
                    $this->migrateMessages();
                }
                $this->migrateBlockNames();
                $this->migrateExtMenu();

            case '3.7':
            case '3.7.0':
                if (!DBUtil::changeTable('blocks')) {
                    return false;
                }

            case '3.7.1':
                $this->newBlockPositions();

            case '3.8.0':
                // update empty filter fields to an empty array
                $entity = $this->name . '_Entity_Block';
                $dql = "UPDATE $entity p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";' OR p.filter = 'a:3:{s:4:\"type\";s:0:\"\";s:9:\"functions\";s:0:\"\";s:10:\"customargs\";s:0:\"\";}'";
                $query = $this->entityManager->createQuery($dql);
                $query->getResult();

            case '3.8.1':
                // register ui_hooks for HTML block editing
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
            case '3.8.2':
                // future upgrade routines
        }

        // Update successful
        return true;
    }
コード例 #18
0
ファイル: Installer.php プロジェクト: rmaiwald/MUBoard
 /**
  * Install the MUBoard application.
  *
  * @return boolean True on success, or false.
  */
 public function install()
 {
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'firstImage');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'secondImage');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'thirdImage');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'firstFile');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'secondFile');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('posting', 'thirdFile');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     $basePath = MUBoard_Util_Controller::getFileBaseFolder('rank', 'uploadImage');
     if (!is_dir($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" does not exist. Please create it before installing this application.', array($basePath)));
     }
     if (!is_writable($basePath)) {
         return LogUtil::registerError($this->__f('The upload folder "%s" is not writable. Please change permissions accordingly before installing this application.', array($basePath)));
     }
     // create all tables from according entity definitions
     try {
         DoctrineHelper::createSchema($this->entityManager, $this->listEntityClasses());
     } catch (Exception $e) {
         if (System::isDevelopmentMode()) {
             LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage());
         }
         return LogUtil::registerError($this->__f('An error was encountered while creating the tables for the %s module.', array($this->getName())));
     }
     // set up all our vars with initial values
     $this->setVar('uploadImages', false);
     $this->setVar('allowedSizeOfImages', 0);
     $this->setVar('numberImages', array('1'));
     $this->setVar('uploadFiles', false);
     $this->setVar('allowedSizeOfFiles', 0);
     $this->setVar('numberFiles', array('1'));
     $this->setVar('editPostings', false);
     $this->setVar('editTime', 6);
     $this->setVar('latestPostings', 1);
     $this->setVar('sortingPostings', array('descending'));
     $this->setVar('iconSet', array('1'));
     $this->setVar('template', array('normal'));
     $this->setVar('pagesize', 10);
     $this->setVar('standardIcon', 'images/icons/extrasmall/favorites.png');
     $this->setVar('specialIcon', 'images/icons/extrasmall/package_favorite.png');
     $this->setVar('showStatisticInDetails', true);
     $this->setVar('showStatisticOnBottom', false);
     // create the default data for MUBoard
     $this->createDefaultData();
     // register persistent event handlers
     $this->registerPersistentEventHandlers();
     // register hook subscriber bundles
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     // initialisation successful
     return true;
 }
コード例 #19
0
ファイル: Installer.php プロジェクト: nmpetkov/Ephemerides
 /**
  * Upgrade ephemerides module
  * @author The Zikula Development Team
  * @return true if init successful, false otherwise
  */
 public function upgrade($oldversion)
 {
     // upgrade dependent on old version number
     switch ($oldversion) {
         case '1.2':
             // version 1.2 shipped with postnuke .72x/.75
             ModUtil::setVar('Ephemerides', 'itemsperpage', 25);
         case '1.6':
             $this->ephemerides_upgrade_updateEphemeridesLanguages();
         case '1.7':
             // needs update of table, added status column
         // needs update of table, added status column
         case '1.8':
             // needs update of table, added type column
         // needs update of table, added type column
         case '1.9':
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             // drop table prefix
             $prefix = $this->serviceManager['prefix'];
             $sqlQueries = array();
             $sqlQueries[] = 'RENAME TABLE ' . $prefix . '_ephem' . " TO `ephem`";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_eid` `eid` INT(11) NOT NULL AUTO_INCREMENT";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_did` `did` TINYINT(4) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_mid` `mid` TINYINT(4) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_yid` `yid` SMALLINT(6) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_language` `language` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_status` `status` TINYINT(4) NULL DEFAULT '1'";
             $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_type` `type` TINYINT(4) NULL DEFAULT '1'";
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             // update table structure according to table defenition
             if (!DBUtil::changeTable('ephem')) {
                 return "1.9";
             }
             // enable categorisation this module
             ModUtil::setVar('Ephemerides', 'enablecategorization', true);
             // create our default category
             if (!$this->_createdefaultcategory()) {
                 LogUtil::registerStatus($this->{$this}->__('Warning! Could not create the default Ephemerides category tree. If you want to use categorisation with Ephemerides, register at least one property for the module in the Category Registry.'));
                 $modvars['enablecategorization'] = false;
             }
         case '3.0.0':
             $connection = Doctrine_Manager::getInstance()->getConnection('default');
             // Change module name from Ephemerids to Ephemerides
             $sqlQueries = array();
             $sqlQueries[] = "UPDATE `modules` SET `name`='Ephemerides', `directory`='Ephemerides', `securityschema`='a:1:{s:13:\"Ephemerides::\";s:14:\"::Ephemerid ID\";}' WHERE `directory`='Ephemerids';";
             $sqlQueries[] = "UPDATE `module_vars` SET `modname`='Ephemerides' WHERE `modname`='Ephemerids';";
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             // Register hooks
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="Ephemerides"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="Ephemerides"';
             $sqlQueries[] = 'DELETE FROM `hook_provider` WHERE `owner`="Ephemerides"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
             HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
         case '3.1.0':
             ModUtil::setVar('Ephemerides', 'enablefacebookshare', false);
         case '3.1.1':
             // future upgrade routines
     }
     // upgrade success
     return true;
 }
コード例 #20
0
ファイル: Installer.php プロジェクト: projectesIF/Sirius
    /**
     * upgrade the News module from an old version
     *
     * @return       bool       true on success, false otherwise
     */
    public function upgrade($oldversion)
    {
        // Upgrade dependent on old version number
        switch ($oldversion)
        {
            case '1.3':
            case '1.4':
                $this->setVar('storyhome', System::getVar('storyhome'));
                System::delVar('storyhome');
                $this->setVar('storyorder', System::getVar('storyorder'));
                System::delVar('storyorder');
                $this->setVar('itemsperpage', 25);

            case '1.5':
                $tables = DBUtil::getTables();
                $shorturlsep = System::getVar('shorturlsseparator');
                // move the data from the author uid to creator and updator uid
                $sqls = array();
                $sqls[] = "UPDATE $tables[stories] SET pn_cr_uid = pn_aid";
                $sqls[] = "UPDATE $tables[stories] SET pn_lu_uid = pn_aid";
                // move the data from the time field to the creation and update datestamp
                $sqls[] = "UPDATE $tables[stories] SET pn_cr_date = pn_time";
                $sqls[] = "UPDATE $tables[stories] SET pn_lu_date = pn_time";
                $sqls[] = "UPDATE $tables[stories] SET pn_urltitle = REPLACE(pn_title, ' ', '{$shorturlsep}')";
                foreach ($sqls as $sql) {
                    if (!DBUtil::executeSQL($sql)) {
                        LogUtil::registerError($this->__('Error! Could not update table.'));
                        return '1.5';
                    }
                }
                // drop the old columns
                DBUtil::dropColumn('stories', array('pn_aid'));
                DBUtil::dropColumn('stories', array('pn_time'));
                $this->setVar('permalinkformat', '%year%/%monthnum%/%day%/%storytitle%');

            case '2.0':
            // import autonews and queue articles
                if (!$this->_import_autonews_queue()) {
                    LogUtil::registerError($this->__('Error! Could not update articles.'));
                    return '2.0';
                }
                // migrate the comments to ezcomments
                if (ModUtil::available('Comments') || defined('_PNINSTALLVER')) {
                    // check for the ezcomments module
                    if (!ModUtil::available('EZComments')) {
                        LogUtil::registerError(__f('Error! The \'%s\' module is not installed.', 'EZComments'));
                        return '2.0';
                    }
                    //  drop the comments table if successful
                    if (ModUtil::apiFunc('EZComments', 'migrate', 'news')) {
                        // drop comments table after migration has succeeded
                        if (!DBUtil::dropTable('comments')) {
                            LogUtil::registerError($this->__('Error! Could not delete table.'));
                            return '2.0';
                        }
                        // remove the Comments module
                        ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('Comments')));
                    }
                }
                // drop the autonews and queue tables, articles are already imported
                if (!DBUtil::dropTable('autonews')) {
                    LogUtil::registerError($this->__('Error! Could not delete table.'));
                    return '2.0';
                }
                if (!DBUtil::dropTable('queue')) {
                    LogUtil::registerError($this->__('Error! Could not delete table.'));
                    return '2.0';
                }
                // remove the AddStory and Submit_News modules
                ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('AddStory')));
                ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('Submit_News')));

            case '2.1':
                $this->setVar('enablecategorization', true);
                ModUtil::dbInfoLoad('News', 'News', true);

                if (!$this->_news_migratecategories()) {
                    LogUtil::registerError($this->__('Error! Could not migrate categories.'));
                    return '2.1';
                }

            case '2.2':
                $this->setVar('refereronprint', System::getVar('refereronprint', 0));

            case '2.3':
                $prefix = System::getVar('prefix');
                // when from is not set, put it to the creation date
                $sqls = array();
                $sqls[] = "UPDATE {$prefix}_stories SET pn_from = pn_cr_date WHERE pn_from IS NULL";
                // make sure we dont have an NULL hometext, since the tables permitted this before 2.4
                $sqls[] = "UPDATE {$prefix}_stories SET pn_hometext = '' WHERE pn_hometext IS NULL";
                foreach ($sqls as $sql) {
                    if (!DBUtil::executeSQL($sql)) {
                        LogUtil::registerError($this->__('Error! Could not update table.'));
                        return '2.3';
                    }
                }
                $this->setVar('enableattribution', false);
                // import the topicimagepath, variable tipath deletion is up to Topics module
                $this->setVar('catimagepath', System::getVar('tipath'));
                $this->setVar('enableajaxedit', false);
                // drop old legacy columns
                DBUtil::dropColumn('stories', 'pn_comments');
                DBUtil::dropColumn('stories', 'pn_themeoverride');
                // clear compiled templates and News cache (see #74)
                ModUtil::apiFunc('view', 'user', 'clear_compiled');
                ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News'));

            case '2.4':
            case '2.4.1':
            // rename the database table from stories to news
                if (!DBUtil::renameTable('stories', 'news')) {
                    LogUtil::registerError($this->__('Error! Could not rename table.'));
                    return '2.4.1';
                }
            case '2.4.2':
            // rename several columns, tables holds the old names for backwards compatibility still
                $columns = array_keys(DBUtil::metaColumns('news', true));

                if (in_array('PN_WITHCOMM', $columns) && !DBUtil::renameColumn('news', 'pn_withcomm', 'disallowcomments')) {
                    LogUtil::registerError($this->__('Error! Could not rename column.'));
                    return '2.4.2';
                }
                if (in_array('PN_INFORMANT', $columns) && !DBUtil::renameColumn('news', 'pn_informant', 'contributor')) {
                    LogUtil::registerError($this->__('Error! Could not rename column.'));
                    return '2.4.2';
                }
                if (in_array('PN_IHOME', $columns) && !DBUtil::renameColumn('news', 'pn_ihome', 'hideonindex')) {
                    LogUtil::registerError($this->__('Error! Could not rename column.'));
                    return '2.4.2';
                }
            case '2.4.3':
            // update table for missing fields etc
                if (!DBUtil::changeTable('news')) {
                    return '2.4.3';
                }
                // update permissions with new scheme News::
                ModUtil::dbInfoLoad('Categories');
                $tables  = DBUtil::getTables();
                $grperms = $tables['group_perms_column'];

                $sqls   = array();
                $sqls[] = "UPDATE $tables[group_perms] SET $grperms[component] = 'News::' WHERE $grperms[component] = 'Stories::Story'";
                // update categories_mapobj and categories_registry with new tablename (categories tables not in $tables ?)
                $sqls[] = "UPDATE $tables[categories_mapobj] SET cmo_table='news' WHERE cmo_table='stories'";
                $sqls[] = "UPDATE $tables[categories_registry] SET crg_table='news' WHERE crg_table='stories'";
                foreach ($sqls as $sql) {
                    if (!DBUtil::executeSQL($sql)) {
                        LogUtil::registerError($this->__('Error! Could not update table.'));
                        return '2.4.3';
                    }
                }
                // Add new variable(s)
                $this->setVar('enablemorearticlesincat', false);
                $this->setVar('morearticlesincat', 0);
                $this->setVar('notifyonpending', false);
                $this->setVar('notifyonpending_fromname', '');
                $this->setVar('notifyonpending_fromaddress', '');
                $this->setVar('notifyonpending_toname', '');
                $this->setVar('notifyonpending_toaddress', '');
                $this->setVar('notifyonpending_subject', $this->__('A News Publisher article has been submitted for review'));
                $this->setVar('notifyonpending_html', true);
                $this->setVar('pdflink', false);
                $this->setVar('pdflink_tcpdfpath', 'config/classes/tcpdf/tcpdf.php');
                $this->setVar('pdflink_tcpdflang', 'config/classes/tcpdf/config/lang/eng.php');
                $this->setVar('pdflink_headerlogo', 'tcpdf_logo.jpg');
                $this->setVar('pdflink_headerlogo_width', '30');

                // clear compiled templates and News cache
                ModUtil::apiFunc('view', 'user', 'clear_compiled');
                ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News'));

            case '2.5':
                // update table
                if (!DBUtil::changeTable('news')) {
                    return '2.5';
                }
            case '2.5.1':
            case '2.5.2':
                // add the new picture column and update the table
                if (!DBUtil::changeTable('news')) {
                    return '2.5.2';
                }
                // add new picture uploading variables
                $this->setVar('picupload_enabled', false);
                $this->setVar('picupload_allowext', 'jpg, gif, png');
                $this->setVar('picupload_index_float', 'left');
                $this->setVar('picupload_article_float', 'left');
                $this->setVar('picupload_maxfilesize', '500000');
                $this->setVar('picupload_maxpictures', '3');
                $this->setVar('picupload_sizing', '0');
                $this->setVar('picupload_picmaxwidth', '600');
                $this->setVar('picupload_picmaxheight', '600');
                $this->setVar('picupload_thumbmaxwidth', '150');
                $this->setVar('picupload_thumbmaxheight', '150');
                $this->setVar('picupload_thumb2maxwidth', '200');
                $this->setVar('picupload_thumb2maxheight', '200');
                $this->setVar('picupload_uploaddir', 'images/news_picupload');
                // add new category parameter
                $this->setVar('enablecategorybasedpermissions', true);

                // permalink format change story to article
                $this->setVar('permalinkformat', str_replace(array('storytitle', 'storyid'), array('articletitle', 'articleid'), $this->getVar('permalinkformat')));

                // clear compiled templates and News cache
                ModUtil::apiFunc('view', 'user', 'clear_compiled');
                ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News'));

            case '2.6.0':
            case '2.6.1':
                $this->setVar('enabledescriptionvar', false);
                $this->setVar('descriptionvarchars', 250);
            case '2.6.2':
            case '2.6.3':
                // register handlers
                EventUtil::registerPersistentModuleHandler('News', 'get.pending_content', array('News_Handlers', 'pendingContent'));
                EventUtil::registerPersistentModuleHandler('News', 'module.content.gettypes', array('News_Handlers', 'getTypes'));
                $prefix = $this->serviceManager['prefix'];
                $connection = Doctrine_Manager::getInstance()->getConnection('default');
                $sqlStatements = array();
                // N.B. statements generated with PHPMyAdmin
                $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_news' . " TO `news`";
                // this removes the prefixes but also changes hideonindex to displayonindex and disallowcomments to allowcomments
                // because 'from' and 'to' are reserved sql words, the column names are changed to ffrom and tto respectively
                $sqlStatements[] = "ALTER TABLE `news` 
CHANGE `pn_sid` `sid` INT( 11 ) NOT NULL AUTO_INCREMENT ,
CHANGE `pn_title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_hometext` `hometext` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_bodytext` `bodytext` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_counter` `counter` INT( 11 ) NULL DEFAULT '0',
CHANGE `pn_contributor` `contributor` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_notes` `notes` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_hideonindex` `displayonindex` TINYINT( 4 ) NOT NULL DEFAULT '0',
CHANGE `pn_language` `language` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `pn_disallowcomments` `allowcomments` TINYINT( 4 ) NOT NULL DEFAULT '0' , 
CHANGE `pn_format_type` `format_type` TINYINT( 4 ) NOT NULL DEFAULT '0',
CHANGE `pn_urltitle` `urltitle` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
CHANGE `pn_published_status` `published_status` TINYINT( 4 ) NULL DEFAULT '0',
CHANGE `pn_from` `ffrom` DATETIME NULL DEFAULT NULL ,
CHANGE `pn_to` `tto` DATETIME NULL DEFAULT NULL ,
CHANGE `pn_obj_status` `obj_status` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A',
CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00' , 
CHANGE `pn_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
CHANGE `pn_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0',
CHANGE `pn_approver` `approver` INT( 11 ) NULL DEFAULT '0',
CHANGE `pn_weight` `weight` TINYINT( 4 ) NULL DEFAULT '0',
CHANGE `pn_pictures` `pictures` INT( 11 ) NULL DEFAULT '0'";
                foreach ($sqlStatements as $sql) {
                    $stmt = $connection->prepare($sql);
                    try {
                        $stmt->execute();
                    } catch (Exception $e) {
                    }   
                }

                if (!DBUtil::changeTable('news')) {
                    return '2.6.3';
                }
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
                $this->delVar('pdflink_tcpdfpath');
                $this->delVar('pdflink_tcpdflang');
                $this->setVar('itemsperadminpage', 15);
                $this->setVar('pdflink_enablecache', true);
				// enable variable for old shorturl scheme (display and main func not shown)
				$this->setVar('shorturls26x', true);
                if (ModUtil::available('Content')) {
                    Content_Installer::updateContentType('News');
                }
                $this->_invertHideAndComments();
                $this->fixStartSettings();
            case '3.0.0':
                // nothing to do
            case '3.0.1':
                // future plans
        }

        // Update successful
        return true;
    }