$shortOptions = 'f:o'; $options = getopt($shortOptions); // No file was given if (!isset($options['f'])) { 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