コード例 #1
0
 /**
  * Returns a singleton instance of the class
  * @access public
  * @return Installer_Class
  */
 public static function i()
 {
     if (!self::$_singleton instanceof Installer_Class) {
         self::$_singleton = new self();
     }
     return self::$_singleton;
 }
コード例 #2
0
 /**
  * Ensure the admin database entries are installed.
  * 
  * If all the required database entries are not installed remove all entries for series 2 seo urls and USU5 and USU5 PRO then install fresh
  * @see Usu_Main::getVar()
  * @see Installer_Class::setConfigConstants()
  * @see Installer_Class::setConfigArray()
  * @see Installer_Class::removeConfigurationGroup()
  * @see Installer_Class::removeConfigurationSettings()
  * @see Installer_Class::dropTable()
  * @see Installer_Class::getConfigGroupId()
  * @see Installer_Class::getMaxSort()
  * @see Installer_Class::addConfigGroup()
  * @see Installer_Class::addConfigSettings()
  * @see Installer_Class::addTable()
  * @uses defined()
  * @uses session_write_close()
  * @uses header() - osC redirect wrapper tep_redirect()
  * 
  * @access private
  * @return void
  */
 private function adminInstalled()
 {
     $needs_install = false;
     foreach (Usu_Main::i()->getVar('config_settings') as $index => $define) {
         if (false === defined($define)) {
             $needs_install = true;
             break;
         }
     }
     // System is not set to uninstall and all the constants are defined so all is well we just return out
     if (false === Usu_Main::$uninstall_db_settings && false === $needs_install) {
         return;
     }
     // If $uninstall_db_settings is true and $needs_install is false we are ready to delete the database entries for USU5
     if (false !== Usu_Main::$uninstall_db_settings && false === $needs_install) {
         include_once Usu_Main::i()->getVar('db_install_path') . 'installer_class.php';
         include_once Usu_Main::i()->getVar('db_install_path') . 'installer_constants.php';
         // deletions
         Installer_Class::i()->setConfigConstants($usu51)->setConfigConstants($usu5)->setConfigConstants($seo_urls2)->setConfigArray()->removeConfigurationGroup()->removeConfigurationSettings()->dropTable();
         return;
         //Set to uninstall but $needs_install is true so the database entries are not present, we do nothing
     } elseif (false !== Usu_Main::$uninstall_db_settings && false !== $needs_install) {
         return;
         // If $uninstall_db_settings is false and $needs_install is true we are ready to install the database entries for USU5
     } elseif (false !== $needs_install && false === Usu_Main::$uninstall_db_settings) {
         include_once Usu_Main::i()->getVar('db_install_path') . 'installer_class.php';
         include_once Usu_Main::i()->getVar('db_install_path') . 'installer_constants.php';
         // deletions
         Installer_Class::i()->setConfigConstants($usu51)->setConfigConstants($usu5)->setConfigConstants($seo_urls2)->setConfigArray()->removeConfigurationGroup()->removeConfigurationSettings()->dropTable();
         // installation
         Installer_Class::i()->getConfigGroupId()->getMaxSort()->addConfigGroup($usu5_config_group)->addConfigSettings($usu5_config)->addTable();
         session_write_close();
         tep_redirect(tep_href_link(FILENAME_DEFAULT));
         exit;
     }
 }