Author: Tijs Verkoyen (tijs@sumocoders.be)
Author: Matthias Mullie (forkcms@mullie.eu)
Inheritance: extends Common\Core\Init
Example #1
0
    throw new Exception('We need a file to load our data from.');
} else {
    $baseFile = $options['f'];
    if (!file_exists($baseFile)) {
        throw new Exception('The given file(' . $baseFile . ') does not exist.');
    }
}
// bootstrap Fork
define('APPLICATION', 'Backend');
$kernel = new AppKernel('prod', false);
$kernel->boot();
$kernel->defineForkConstants();
if (!defined('PATH_WWW')) {
    define('PATH_WWW', __DIR__ . '/..');
}
$loader = new BackendInit($kernel);
$loader->initialize('Backend');
$loader->passContainerToModels();
// create needed constants
$container = $kernel->getContainer();
// Set the overwrite parameter
$overwrite = isset($options['o']);
// Set the basedir
$baseDir = getcwd() . '/..';
// load the xml from the file
$xmlData = @simplexml_load_file($baseFile);
// this is an invalid xml file
if ($xmlData === false) {
    throw new Exception('Invalid locale.xml file.');
}
// Everything ok, let's install the locale
Example #2
0
 /**
  * @param string $app The name of the application to load (ex. BackendAjax)
  *
  * @return string The name of the application class we need to instantiate.
  */
 protected function initializeBackend($app)
 {
     $init = new BackendInit($this->container->get('kernel'));
     $init->initialize($app);
     switch ($app) {
         case 'BackendAjax':
             $applicationClass = 'Backend\\Core\\Engine\\Ajax';
             break;
         case 'BackendCronjob':
             $applicationClass = 'Backend\\Core\\Engine\\Cronjob';
             break;
         default:
             $applicationClass = 'Backend\\Core\\Engine\\Backend';
     }
     return $applicationClass;
 }