Exemplo n.º 1
0
 /**
  * Primary bootstrapping for TubePress.
  */
 function bootTubePress()
 {
     /**
      * First, record the root path.
      */
     if (!defined('TUBEPRESS_ROOT')) {
         define('TUBEPRESS_ROOT', realpath(dirname(__FILE__) . '/../../../../'));
     }
     /*
      * Finally, hand off control to the TubePress bootstrapper. This will
      *
      * 1. Setup logging.
      * 2. Build and compile the core IOC container.
      * 3. Load system add-ons
      * 4. Load user add-ons
      */
     require TUBEPRESS_ROOT . '/src/main/php/classes/tubepress/impl/boot/PrimaryBootstrapper.php';
     $bootStrapper = new tubepress_impl_boot_PrimaryBootstrapper();
     $bootStrapper->boot();
     define('TUBEPRESS_BOOT_COMPLETE', true);
 }
 /**
  * Performs TubePress-wide initialization.
  *
  * @return boolean True if boot completed normally, false otherwise.
  */
 public final function boot()
 {
     /**
      * Don't boot twice!
      */
     if (self::$_alreadyBooted) {
         return true;
     }
     /**
      * Setup initial class loader.
      */
     $this->_01_buildInitialClassLoader();
     /*
      * Setup basic logging facilities.
      */
     $this->_02_configureLogging();
     /**
      * Record start time.
      */
     $this->_03_recordStartTime();
     try {
         $this->_04_buildInitialIocContainer();
         $this->_05_primeClassMap();
         $this->_06_configureLoggingForWordPress();
         $this->_07_discoverAddons();
         $this->_08_registerAddonClassHints();
         $this->_09_compileIocContainer();
         $this->_10_bootAddons();
         $this->_11_dispatchBootCompleteEvent();
         $this->_12_flushLogIfNeeded();
     } catch (Exception $e) {
         if ($this->_shouldLog) {
             $this->_logger->error('Caught exception while booting: ' . $e->getMessage());
             //flush out log statements
             $this->_loggingHandler->setStatus(true);
         }
         return false;
     }
     /**
      * Remember that we booted.
      */
     self::$_alreadyBooted = true;
     /**
      * Record finish time.
      */
     $this->_13_recordFinishTime();
     /**
      * Free up some memory.
      */
     $this->_14_freeMemory();
     return true;
 }