Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * initialise module
  */
 public function install()
 {
     // create tables
     $classes = array('Zikula\\Core\\Doctrine\\Entity\\Category', 'Zikula\\Core\\Doctrine\\Entity\\CategoryAttribute', 'Zikula\\Core\\Doctrine\\Entity\\CategoryRegistry');
     try {
         \DoctrineHelper::createSchema($this->entityManager, $classes);
     } catch (\Exception $e) {
         return false;
     }
     // insert some default data
     $this->insertData_10();
     // Set autonumber to 10000 (for DB's that support autonumber fields)
     $cat = new \Zikula\Core\Doctrine\Entity\Category();
     $cat['id'] = 9999;
     $this->entityManager->persist($cat);
     $this->entityManager->flush();
     $this->entityManager->remove($cat);
     $this->entityManager->flush();
     // set module vars
     $this->setVar('userrootcat', '/__SYSTEM__/Users');
     $this->setVar('allowusercatedit', 0);
     $this->setVar('autocreateusercat', 0);
     $this->setVar('autocreateuserdefaultcat', 0);
     $this->setVar('userdefaultcatname', 'Default');
     // Initialisation successful
     return true;
 }
Exemplo n.º 3
0
    /**
     * Initialise the Admin module.
     * This function is only ever called once during the lifetime of a particular
     * module instance
     *
     * @return boolean True if initialisation succcesful, false otherwise.
     */
    public function install()
    {
        // create tables
        try {
            DoctrineHelper::createSchema($this->entityManager, array('Admin_Entity_AdminCategory', 'Admin_Entity_AdminModule'));
        } catch (Exception $e) {
            return false;
        }

        $this->setVar('modulesperrow', 3);
        $this->setVar('itemsperpage', 15);
        $this->setVar('defaultcategory', 5);
        $this->setVar('admingraphic', 1);
        $this->setVar('startcategory', 1);
        // change below to 0 before release - just makes it easier doing development meantime - drak
        // we can now leave this at 0 since the code also checks the development flag (config.php) - markwest
        $this->setVar('ignoreinstallercheck', 0);
        $this->setVar('admintheme', '');
        $this->setVar('displaynametype', 1);

        $this->defaultdata();

        // Initialisation successful
        return true;
    }
Exemplo n.º 4
0
 /**
  * Install the ExampleModule module.
  *
  * @return boolean
  */
 public function install()
 {
     // create database schema
     try {
         \DoctrineHelper::createSchema($this->entityManager, array('ExampleModule\\Entity\\User', 'ExampleModule\\Entity\\UserCategory', 'ExampleModule\\Entity\\UserAttribute', 'ExampleModule\\Entity\\UserMetadata'));
     } catch (\Exception $e) {
         return false;
     }
     $this->defaultdata();
     // Initialisation successful
     return true;
 }
Exemplo n.º 5
0
 /**
  * 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;
 }
Exemplo n.º 6
0
 /**
  * initialise the permissions module
  *
  * This function is only ever called once during the lifetime of a particular
  * module instance.
  * This function MUST exist in the pninit file for a module
  *
  * @return       bool       true on success, false otherwise
  */
 public function install()
 {
     // create the table
     try {
         \DoctrineHelper::createSchema($this->entityManager, array('Permission'));
     } catch (\Exception $e) {
         return false;
     }
     // Create any default for this module
     $this->defaultdata();
     // Initialisation successful
     return true;
 }
Exemplo n.º 7
0
 /**
  * Install the ExampleDoctrine module.
  *
  * This function is only ever called once during the lifetime of a particular
  * module instance.
  *
  * @return boolean True on success, false otherwise.
  */
 public function install()
 {
     // create the table
     try {
         DoctrineHelper::createSchema($this->entityManager, array('ExampleDoctrine_Entity_User', 'ExampleDoctrine_Entity_UserCategory', 'ExampleDoctrine_Entity_UserAttribute', 'ExampleDoctrine_Entity_UserMetadata'));
     } catch (Exception $e) {
         return false;
     }
     $this->defaultcategories();
     $this->defaultdata();
     // Initialisation successful
     return true;
 }
Exemplo n.º 8
0
 /**
  * initialise the blocks module
  *
  * @return       bool       true on success, false otherwise
  */
 public function install()
 {
     // create tables
     $classes = array('BlocksModule\\Entity\\Block', 'BlocksModule\\Entity\\BlockPosition', 'BlocksModule\\Entity\\BlockPlacement', 'BlocksModule\\Entity\\UserBlock');
     try {
         \DoctrineHelper::createSchema($this->entityManager, $classes);
     } catch (\Exception $e) {
         return false;
     }
     // Set a default value for a module variable
     $this->setVar('collapseable', 0);
     // Initialisation successful
     return true;
 }
Exemplo n.º 9
0
 /**
  * @return bool
  */
 public function install()
 {
     try {
         DoctrineHelper::createSchema($this->entityManager, array('Dashboard_Entity_Widget', 'Dashboard_Entity_UserWidget'));
     } catch (Exception $e) {
         return false;
     }
     $this->setVar('widgets_per_row', 5);
     $this->setVar('available_per_row', 5);
     $this->setVar('new_user', 1);
     EventUtil::registerPersistentModuleHandler($this->name, 'installer.module.uninstalled', array('Dashboard_Listener_UninstallListener', 'onUninstallModule'));
     EventUtil::registerPersistentModuleHandler($this->name, 'user.account.create', array('Dashboard_Listener_CreateUserListener', 'onCreateUser'));
     EventUtil::registerPersistentModuleHandler($this->name, 'user.account.delete', array('Dashboard_Listener_RemoveUserListener', 'onRemoveUser'));
     return true;
 }
Exemplo n.º 10
0
 /**
  * Install the Extensions module.
  *
  * @return boolean true if installation is successful, false otherwise
  */
 public function install()
 {
     // create tables
     $tables = array('Zikula\\ExtensionsModule\\Entity\\ExtensionEntity', 'Zikula\\ExtensionsModule\\Entity\\ExtensionDependencyEntity', 'Zikula\\ExtensionsModule\\Entity\\ExtensionVarEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookAreaEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookBindingEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookProviderEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookRuntimeEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookSubscriberEntity');
     try {
         \DoctrineHelper::createSchema($this->entityManager, $tables);
     } catch (\Exception $e) {
         return false;
     }
     // populate default data
     $this->defaultdata();
     $this->setVar('itemsperpage', 25);
     // Initialisation successful
     return true;
 }
Exemplo n.º 11
0
 /**
  * initialise the Search module
  * This function is only ever called once during the lifetime of a particular
  * module instance
  */
 public function install()
 {
     // create the table
     try {
         \DoctrineHelper::createSchema($this->entityManager, array('SearchModule\\Entity\\SearchResultEntity', 'SearchModule\\Entity\\SearchStatEntity'));
     } catch (\Exception $e) {
         return false;
     }
     // create module vars
     $this->setVar('itemsperpage', 10);
     $this->setVar('limitsummary', 255);
     // register event handler to activate new modules in the search block
     EventUtil::registerPersistentModuleHandler('Search', 'installer.module.installed', array('SearchModule\\Listener\\EventListener', 'moduleInstall'));
     // Initialisation successful
     return true;
 }
Exemplo n.º 12
0
 /**
  * Install the Extensions module.
  *
  * @return boolean
  */
 public function install()
 {
     // create tables
     $tables = array('Zikula\\Core\\Doctrine\\Entity\\Extension', 'Zikula\\Core\\Doctrine\\Entity\\ExtensionDependency', 'Zikula\\Core\\Doctrine\\Entity\\ExtensionVar', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookAreaEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookBindingEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookProviderEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookRuntimeEntity', 'Zikula\\Component\\HookDispatcher\\Storage\\Doctrine\\Entity\\HookSubscriberEntity');
     try {
         \DoctrineHelper::createSchema($this->entityManager, $tables);
     } catch (Exception $e) {
         return false;
     }
     // create hook provider table.
     EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('ExtensionsModule\\HookUI', 'hooks'));
     EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('ExtensionsModule\\HookUI', 'moduleservices'));
     // populate default data
     $this->defaultdata();
     $this->setVar('itemsperpage', 25);
     // Initialisation successful
     return true;
 }
Exemplo n.º 13
0
 /**
  * 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;
 }
Exemplo n.º 14
0
 /**
  * @BeforeScenario
  */
 public function createSchema()
 {
     $this->doctrineHelper->createSchema();
 }
 public function install()
 {
     // create table
     \DoctrineHelper::createSchema($this->entityManager, $this->entities);
     //$this->variableApi->setAll($this->name, $modvars);
     /*
     try {
         $this->schemaTool->create($this->entities);
     } catch (\Exception $e) {
         $this->addFlash('error', $e->getMessage());
         return false;
     }
     
     // insert default category
     try {
         $this->createCategoryTree();
     } catch (\Exception $e) {
         $this->addFlash('error', $this->__f('Did not create default categories (%s).', $e->getMessage()));
     }
     // set up config variables
     $modvars = array(
         'itemsperpage' => 25,
         'enablecategorization' => true
     );
     $this->variableApi->setAll($this->name, $modvars);
     $hookContainer = $this->hookApi->getHookContainerInstance($this->bundle->getMetaData());
     \HookUtil::registerSubscriberBundles($hookContainer->getHookSubscriberBundles());
     \HookUtil::registerProviderBundles($hookContainer->getHookProviderBundles());
     */
     // initialisation successful
     return true;
 }