Пример #1
0
 * Date: 15/05/14
 * Time: 16:05
 */
define('WEBROOT', __DIR__);
define('ROOT', dirname(WEBROOT));
define('DS', DIRECTORY_SEPARATOR);
function __autoload($class_name)
{
    $filename = ROOT . DS . str_replace("\\", DS, $class_name) . ".php";
    if (file_exists($filename)) {
        require_once $filename;
    } else {
    }
}
//Retour visuel
\config\Conf::$debuglocalfile = false;
\model\simple\Console::println("Configuration de mediastorrent");
exec("chmod a+w " . ROOT . DS . "log");
exec("chmod a+w " . ROOT . DS . "cache");
exec("chmod a+w " . ROOT . DS . "config" . DS . "Conf.php");
exec('echo "php ' . ROOT . DS . "script" . DS . 'cronroot.php &>> ' . ROOT . DS . "log" . DS . 'cronroot.log"  >> ' . ROOT . DS . "script" . DS . "cronroot.sh");
exec("chmod a+x " . ROOT . DS . "script" . DS . "cronroot.sh");
exec("chmod a+x " . ROOT . DS . "script" . DS . "createtorrent.sh");
$c = \model\simple\Console::execute("awk -F= '\$1 ~ /^ID\$/ {print \$2}' /etc/os-release");
if ($c[0] === 1) {
    throw new Exception("Impossible de trouver la distribution");
}
\config\Conf::$distribution = $c[1];
$c = \model\simple\Console::execute("ls -l /proc/1/exe | awk '{ print \$11 }'");
if ($c[0] === 1) {
    throw new Exception("Impossible de trouver l'init..");