Exemplo n.º 1
0
define('TS_INIT', true);
// add autoloader
spl_autoload_register(function ($class) {
    include __DIR__ . '/classes/' . $class . '.class.php';
});
// start session
session_start();
// set global values
global $Config;
global $Log;
// create global objects
$Config = new ts_ConfigurationHandler();
$Log = new ts_Log($Config->get('loglevel'));
// create other objects
$DummyPacket = new ts_DummyPacket();
$PreParser = new ts_PreParser($DummyPacket);
// preparse all backend files
$path = __DIR__;
if ($PreParser->parse($path, $path, $Config->get('dir_runtime'), true)) {
    echo "Backend ready.<br />\n";
} else {
    echo "ERROR: Could not preparse backend!<br />\n";
}
echo "Done...\n";
/**
 * Dummy packet to get access to PreParsing object
 */
class ts_DummyPacket
{
    /** Array to cache version.xml
     * @var array $infofile
Exemplo n.º 2
0
 /** Preparse and move all files and subfolders within path
  *
  * @return bool
  */
 protected function _preparse()
 {
     global $Config;
     // get new path
     $path_new = $this->_getPath(false, false);
     // free path
     if ($this->path == $path_new) {
         // move
         $path_old = $this->path . '__moved_by_preparser_' . rand(1, 1000);
         ts_FileHandler::copyFolder($this->path, $path_old);
         $this->path = $path_old;
     } elseif (is_dir($path_new)) {
         ts_BackupHandler::backupModule($path_new, 'invalid_name');
     }
     ts_FileHandler::deleteFolder($path_new);
     // load PreParser-object
     $PreParser = new ts_PreParser($this);
     // parse
     if ($PreParser->parse($this->path, $path_new, $Config->get('dir_data'))) {
         // success
         // delete old source
         ts_FileHandler::deleteFolder($this->path);
         $this->path = $path_new;
         return true;
     }
     // failure
     ts_FileHandler::deleteFolder($path_new);
     return false;
 }