function deleteCampeonato($objCampeonato)
{
    $sqlCommand = 'DELETE FROM circuito.campeonato WHERE id = :id';
    $parameters = array();
    $parameters[':id'] = $objCampeonato->id;
    return executeCommand($sqlCommand, $parameters);
}
Beispiel #2
0
function runJavaTests($clientRoot)
{
    global $config;
    $jdkPath = $config['java']['jdk_path'];
    $externalJars = listDir("{$clientRoot}/lib");
    if (!is_dir("{$clientRoot}/bin")) {
        mkdir("{$clientRoot}/bin");
    }
    chdir("{$clientRoot}/bin");
    // compile the client library
    executeCommand("{$jdkPath}javac.exe", "-d . -sourcepath ../src -cp " . implode(';', addPrefix($externalJars, '../lib/')) . " ../src/com/kaltura/client/test/KalturaTestSuite.java");
    // pack the client library
    executeCommand("{$jdkPath}jar.exe", "cvf kalturaClient.jar .");
    // run the tests
    copy("{$clientRoot}/src/DemoImage.jpg", "{$clientRoot}/bin/DemoImage.jpg");
    copy("{$clientRoot}/src/DemoVideo.flv", "{$clientRoot}/bin/DemoVideo.flv");
    copy("{$clientRoot}/src/test.properties", "{$clientRoot}/bin/test.properties");
    $log4jConfig = fixSlashes("{$clientRoot}/src/log4j/log4j.properties");
    if ($log4jConfig[1] == ':') {
        $log4jConfig = substr($log4jConfig, 2);
    }
    $log4jParam = "-Dlog4j.configuration=file://{$log4jConfig}";
    $jarList = "bin/kalturaClient.jar;" . implode(';', addPrefix($externalJars, 'lib/'));
    chdir($clientRoot);
    executeCommand("{$jdkPath}java.exe", "-cp {$jarList} {$log4jParam} org.junit.runner.JUnitCore com.kaltura.client.test.KalturaTestSuite");
}
function deleteCategoria($objCategoria)
{
    $sqlCommand = 'DELETE FROM circuito.categorias WHERE id = :id';
    $parameters = array();
    $parameters[':id'] = $objCategoria->id;
    return executeCommand($sqlCommand, $parameters);
}
Beispiel #4
0
function enableCliente($objCliente)
{
    $sqlCommand = 'UPDATE cliente ' . 'SET activo = 1 ' . 'WHERE id=:id';
    $parameters = array();
    $parameters[':id'] = $objCliente->id;
    return executeCommand($sqlCommand, $parameters);
}
function deletePartida($objPartida)
{
    $sqlCommand = 'DELETE FROM circuito.partidas WHERE id = :id';
    $parameters = array();
    $parameters[':id'] = $objPartida->id;
    return executeCommand($sqlCommand, $parameters);
}
function deleteJogador($objJogador)
{
    $sqlCommand = 'DELETE FROM circuito.jogadores WHERE id = :id';
    $parameters = array();
    $parameters[':id'] = $objJogador->id;
    return executeCommand($sqlCommand, $parameters);
}
function deleteUsuario($objUsuario)
{
    $sqlCommand = 'DELETE FROM circuito.usuario WHERE id = :id';
    $parameters = array();
    $parameters[':id'] = $objUsuario->id;
    return executeCommand($sqlCommand, $parameters);
}
Beispiel #8
0
function updateUsuario($objUsuario)
{
    $sqlCommand = 'UPDATE usuario ' . 'SET Nombre=:nombre,Username=:username,Contrasena=:contrasena ' . 'WHERE Id = :id ';
    $parameters = array();
    $parameters[':id'] = $objUsuario->id;
    $parameters[':nombre'] = $objUsuario->nombre;
    $parameters[':username'] = $objUsuario->username;
    $parameters[':contrasena'] = $objUsuario->contrasena;
    return executeCommand($sqlCommand, $parameters);
}
Beispiel #9
0
function getListZips()
{
    $database = connectToDb();
    if (!$database) {
        return false;
    }
    $result = executeCommand($database, "getListOfZips", NULL);
    if (!$result) {
        return false;
    } else {
        return $result;
    }
}
Beispiel #10
0
<?php

require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
$kernel = new AppKernel('test', true);
// create a "test" kernel
$kernel->boot();
ini_set('memory_limit', '268435456');
$application = new Application($kernel);
$application->setAutoExit(false);
//deleteDatabase();
executeCommand($application, "doctrine:schema:create");
executeCommand($application, "doctrine:fixtures:load");
backupDatabase();
function executeCommand($application, $command, array $options = array())
{
    $options["--env"] = "test";
    $options["--quiet"] = true;
    $options = array_merge($options, array('command' => $command));
    $arrayInput = new ArrayInput($options);
    $arrayInput->setInteractive(false);
    $application->run($arrayInput);
}
function deleteDatabase()
{
    $folder = __DIR__ . '/cache/test/';
    foreach (array('test.db', 'test.db.bk') as $file) {
        if (file_exists($folder . $file)) {
            unlink($folder . $file);
Beispiel #11
0
<?php

ini_set('memory_limit', '1024M');
require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
$kernel = new AppKernel('test', true);
$kernel->boot();
$application = new Application($kernel);
$application->setAutoExit(false);
deleteDatabase();
executeCommand($application, "doctrine:schema:create");
executeCommand($application, "ojs:install:travis");
executeCommand($application, "h4cc_alice_fixtures:load:sets");
backupDatabase();
function deleteDatabase()
{
    $folder = __DIR__ . '/cache/test/';
    foreach (['test.db', 'test.db.bk'] as $file) {
        if (file_exists($folder . $file)) {
            unlink($folder . $file);
        }
    }
}
function backupDatabase()
{
    copy(__DIR__ . '/cache/test/test.db', __DIR__ . '/cache/test/test.db.bk');
}
function restoreDatabase()
{
                    $dump['speed'] = $config['maxspeed'];
                }
            } else {
                $dump['speed'] *= $config['tuning_sub'];
                if ($dump['speed'] < $config['minspeed']) {
                    $dump['speed'] = $config['minspeed'];
                }
            }
            $dump['speed'] = (int) $dump['speed'];
            $dump['page_refreshs']++;
        } else {
            //Backup for all databases is done
            $dump['data'] = "\nSET FOREIGN_KEY_CHECKS=1;";
            $dump['data'] .= "\n" . '-- EOB' . "\n\n";
            writeToDumpFile();
            executeCommand('a');
            chmod($config['paths']['backup'] . $dump['backupdatei'], 0777);
            $logMsg = sprintf($lang['L_DUMP_OF_DB_FINISHED'], $dump['db_actual']);
            $log->write(Log::PHP, $logMsg);
            checkForNextDB();
        }
    }
}
// everything is dumped -> check for e-mail and ftp-actions
if ($dump['backup_done'] == 1) {
    if (count($_SESSION['log']['files_created']) > 0) {
        if (!isset($_SESSION['log']['email'])) {
            // first call after backup is finished -> create todo-list
            $_SESSION['log']['email'] = array();
            $_SESSION['email']['filelist'] = array();
            $_SESSION['log']['ftp'] = array();
Beispiel #13
0
<?php

require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
$kernel = new AppKernel('test', true);
// create a "test" kernel
$kernel->boot();
$application = new Application($kernel);
$application->setAutoExit(false);
deleteDatabase();
executeCommand($application, 'doctrine:schema:create');
executeCommand($application, 'doctrine:fixtures:load --fixtures=src\\Truckee\\MatchBundle\\DataFixtures\\Test');
backupDatabase();
function executeCommand($application, $command, array $options = array())
{
    $options['--env'] = 'test';
    $options['--quiet'] = true;
    $options = array_merge($options, array('command' => $command));
    $application->run(new ArrayInput($options));
}
function deleteDatabase()
{
    $folder = __DIR__ . '/cache/test/';
    foreach (array('test.sqlite', 'test.db.sqlite') as $file) {
        if (file_exists($folder . $file)) {
            unlink($folder . $file);
        }
    }
}
Beispiel #14
0
function deliver($objEquipo)
{
    $sqlCommand = 'UPDATE presupuesto SET Status=:status ' . ' WHERE Equipo_Id=:id';
    $parameters = array();
    $parameters[':status'] = $objEquipo->status;
    $parameters[':id'] = $objEquipo->id;
    return executeCommand($sqlCommand, $parameters);
}
Beispiel #15
0
         //restore original dir
         @chdir($pwd);
         return $return;
     }
     $error = '';
     $return = executeCommand('which php 2>&1', $error);
     if ($error && $return !== false) {
         $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, unable to find php CLI with command "which php" : ' . $error . '</li>';
     }
     if ($return === false) {
         $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, commands passthru() and exec() are not available. PHP CLI is not usable.</li>';
     } elseif (substr($return, 0, 1) != '/') {
         $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, unable to find php CLI with command "which php"</li>';
     } else {
         //test CLI version
         $return = executeCommand('php -v', $error);
         if ($return === false) {
             $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, PHP CLI not found' . "\n";
         } elseif (strpos(strtolower($return), '(cli)') === false) {
             $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, installed php is not the CLI version : ' . $return . "\n";
         } else {
             $cliversion = trim(str_replace('php ', '', substr(strtolower($return), 0, strpos(strtolower($return), '(cli)'))));
             if (version_compare($cliversion, "5.2.0") === -1) {
                 $content .= '<li class="atm-pic-cancel"><strong style="color:orange">Warning</strong>, PHP CLI version (' . $cliversion . ') not match</li>';
             } else {
                 $content .= '<li class="atm-pic-ok">PHP CLI version <strong style="color:green">OK</strong> (' . $cliversion . ')</li>';
             }
         }
     }
 }
 //Conf PHP
Beispiel #16
0
function doReview($parameter)
{
    doReset();
    echo '<br /><b>Review on review.local.typo3.org</b><br />';
    my_flush();
    chdir('/var/www/review.local.typo3.org/typo3_src');
    // Check if git user is set
    $user = executeCommand('git config --get user.name');
    if (empty($user)) {
        $user = executeCommand('git config user.name vagrant');
        $user = executeCommand('git config user.email vagrant@localhost');
        echo str_replace(chr(10), '<br />', 'Setting first time user') . '<br /><br /><br />';
    }
    // Check if parameter contains ssh access
    // git fetch http://review.typo3.org/Packages/TYPO3.CMS refs/changes/68/43868/11 && git cherry-pick FETCH_HEAD
    // git fetch ssh://michadu@review.typo3.org:29418/Packages/TYPO3.CMS refs/changes/68/43868/11 && git cherry-pick FETCH_HEAD
    if (substr($parameter, 0, 14) == 'git fetch ssh:') {
        $cherry = substr($parameter, strpos($parameter, 'Packages'));
        $parameter = 'git fetch http://review.typo3.org/' . $cherry;
    }
    liveExecuteCommand($parameter);
    my_flush();
}
Beispiel #17
0
         $errorFilename = "{$filename}.erroroutput";
         $sourceCode = executeCommand("java -jar umplesync.jar -generate {$language} {$filename} 2> {$errorFilename}");
         $errors = getErrorHtml($errorFilename, 0);
         if ($outputErr == "true") {
             echo $errors . "<p>URL_SPLIT";
         }
         echo $sourceCode;
         return;
     } elseif (!in_array($language, array("Php", "Java", "Ruby", "RTCpp", "Cpp", "Sql", "GvStateDiagram", "GvClassDiagram", "GvEntityRelationshipDiagram", "GvClassTraitDiagram", "Yuml"))) {
         // If NOT one of the basic languages, then use umplesync.jar
         $filename = saveFile($input);
         $errorFilename = "{$filename}.erroroutput";
         if ($language == "Experimental-Cpp" || $language == "Experimental-Sql") {
             $sourceCode = executeCommand("echo \"{$language} is under development. Output is currently only available to developers of Umple\" 2> {$errorFilename}");
         } else {
             $sourceCode = executeCommand("java -jar umplesync.jar -generate {$language} {$filename} 2> {$errorFilename}");
         }
         $errors = getErrorHtml($errorFilename, 0);
         if ($language != "Json" && $language != "JsonMixed") {
             $sourceCode = htmlspecialchars($sourceCode);
         }
         if ($outputErr == "true") {
             echo $errors . "<p>URL_SPLIT";
         }
         echo $sourceCode;
         return;
     }
 }
 if (!$uigu) {
     // NOTuigu
     // Generate the Java, PHP, RTCpp, Ruby, Cpp or Sql and put it into the right directory
Beispiel #18
0
// Read updates
$content = file_get_contents("php://input");
$update = json_decode($content, true);
$chatID = $update["message"]["chat"]["id"];
if (!isset($update["message"])) {
    exit;
}
// Extract data
$message = $update["message"]["text"];
$firstName = $update["message"]["from"]["first_name"];
$lastName = $update["message"]["from"]["last_name"];
$userName = $update["message"]["from"]["username"];
$date = gmdate("d/m/Y", $update["message"]["date"]);
// Log precious informations
// todo: using a database may be better
$logData = "From:[{$firstname} ,{$lastname}, {$username}] on:[{$date}] query:[{$message}] chatid:[{$chatID}]\n";
file_put_contents("secret_messages.log", $logData, FILE_APPEND);
// Execute command
if (DEBUG_MESSAGES) {
    sendMessage("Message received: {$message}", $chatID);
}
$params = explode(" ", $message);
if ($params[0][0] != '/') {
    exit;
}
$command = $params[0];
if (DEBUG_MESSAGES) {
    sendMessage("debug_info: executing {$command}", $chatID);
}
executeCommand($params, $chatID);
Beispiel #19
0
    $command = "cd {$currentDir} && {$command}";
    list($output, $error, $code) = executeCommand($command);
    header("Content-Type: text/plain; charset=utf-8");
    echo formatOutput($userCommand, htmlspecialchars($output));
    echo htmlspecialchars($error);
    exit(0);
    // Terminate app
} else {
    // Send frontend to user.
    header('Content-Type: text/html; charset=utf-8');
    // Show current dir name.
    $currentDirName = explode('/', $currentDir);
    $currentDirName = end($currentDirName);
    // Show current user.
    $whoami = isset($commands['*']) ? str_replace('$1', 'whoami', $commands['*']) : 'whoami';
    list($currentUser) = executeCommand($whoami);
    $currentUser = trim($currentUser);
}
###############################################
#                  Functions                  #
###############################################
function searchCommand($userCommand, array $commands, &$found = false, $inValues = true)
{
    foreach ($commands as $key => $value) {
        list($pattern, $format) = $inValues ? array($value, '$1') : array($key, $value);
        $pattern = '/^' . str_replace('\\*', '(.*?)', preg_quote($pattern)) . '$/i';
        if (preg_match($pattern, $userCommand)) {
            if (false !== $found) {
                $found = preg_replace($pattern, $format, $userCommand);
            }
            return true;
Beispiel #20
0
function executeCommandFrom($path, $exe, $params = null)
{
    chdir($path);
    executeCommand($exe, $params);
}
function cleanupOldFiles()
{
    if (rand(1, 100) == 50) {
        executeCommand("scripts/cleanumpinbackground");
        // OLD
        // 1 percent of the time delete old temp directories older than 30 days ago
        //  executeCommand("find ./ump -maxdepth 1 -type d -mtime +30 | grep -v .svn | grep /tmp | xargs rm -rf");
        // The following commented out because it takes too long - use ralph script cleanump
        // delete empty directories older than 2 days - typically produced when Javascript off
        //executeCommand("find ./ump -maxdepth 1 -type d -empty -mtime +2 | grep -v .svn |  xargs rm -rf");
    }
}
Beispiel #22
0
<?php

require_once __DIR__ . '/utils.php';
if ($argc < 2) {
    die("Usage:\n\tphp " . basename(__FILE__) . " <root dir>\n");
}
$rootDir = fixSlashes($argv[1]);
chdir($rootDir);
$fileList = listDir($rootDir);
foreach ($fileList as $file) {
    if (endsWith($file, '.tar.gz')) {
        executeCommand('tar', "-zxvf {$file}");
    }
}