예제 #1
0
 /**
  * Installs a new downloaded or deployed model under POKELIO_MODULES_PATH
  * 
  * @param string $moduleName Name of the module to be installed
  */
 public static function installModule($moduleName)
 {
     //Are installations allowed?
     if (_::getConfig('ALLOW_INSTALLATIONS') === true) {
         //Do the module folder exists?
         if (file_exists(POKELIO_MODULES_PATH . '/' . $moduleName)) {
             //Do Install.php file exists?
             if (file_exists(POKELIO_MODULES_PATH . '/' . $moduleName . '/Install/Install.php')) {
                 //Invoke installation script for module
                 if (is_callable($moduleName . "_Install::execute")) {
                     $success = call_user_func($moduleName . "_Install::execute");
                     if ($success == true) {
                         self::successInstall($moduleName);
                     } else {
                         self::failedInstall($moduleName);
                     }
                 } else {
                     _::abort("Corrupted Install class of module " . $moduleName);
                 }
             } else {
                 _::abort("Corrupted (or already deployed) module. (Install.php does not exist)");
             }
         } else {
             _::abort("Module folder " . $moduleName . " does not exist under " . POKELIO_MODULES_PATH);
         }
     } else {
         _::abort("Installations are not allowed. Check Pokelio configuration file.");
     }
 }