Ejemplo n.º 1
0
 /**
  * Checks real-time execution of the script.
  * @param integer $time
  * @return array
  * @static
  * @final
  */
 public static final function ActualExecutionTime($time = 0)
 {
     global $count, $js;
     if (Server::PHPInterface() == 'cli' || FileSystem::FileDeletion() === false || Server::SharedMemory() === false) {
         return false;
     }
     if ($time == 0) {
         $time = Server::MaxExecutionTime();
     }
     $time = (int) $time;
     $tok = ftok(__FILE__, 'A');
     $shmId = shm_attach($tok);
     @shm_remove($shmId);
     if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time.php")) {
         @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time.php");
     }
     if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time_wait.php")) {
         @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time_wait.php");
     }
     $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time.php", 'wb');
     @fputs($file, "<?php\n" . "if (function_exists('shm_attach') === false) {\n" . "    exit();\n" . "}\n\n" . "\$shmId = shm_attach({$tok});\n" . "@ini_set('display_errors', false);\n" . "@error_reporting(-1);\n\n" . "@set_time_limit({$time});\n" . "@ini_set('max_execution_time', {$time});\n\n" . "for (\$i = 1; \$i <= {$time}; \$i++) {\n" . "    sleep(1);\n" . "    shm_put_var(\$shmId, 1, \$i);\n" . "}\n" . '?>');
     @fclose($file);
     $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_actual_time_wait.php", 'wb');
     @fputs($file, "<?php\n" . "if (function_exists('shm_attach') === false) {\n" . "    exit();\n" . "}\n\n" . "\$shmId = shm_attach({$tok});\n" . "@ini_set('display_errors', false);\n" . "@error_reporting(-1);\n\n" . "@set_time_limit({$time});\n" . "@ini_set('max_execution_time', {$time});\n\n" . "if (@shm_has_var(\$shmId, 1) && \$_GET['seconds'] < @shm_get_var(\$shmId, 1)) {\n" . "    echo @shm_get_var(\$shmId, 1);\n" . "} else {\n" . "    @shm_remove(\$shmId);\n" . "    @unlink('{$_SERVER['DOCUMENT_ROOT']}/test_actual_time.php');\n" . "    @unlink('{$_SERVER['DOCUMENT_ROOT']}/test_actual_time_wait.php');\n" . "}\n" . '?>');
     @fclose($file);
     $cnt = $count + 1;
     $js .= "\$('#value-{$cnt}').parent('tr').removeClass().addClass('active');\n" . "\$('#value-{$cnt}').siblings('.loader').html('<img src=\"https://www.crazydogtshirts.com/skin/frontend/mtcolias/default/images/loader.gif\"/>');\n" . "\$.get( \"" . dirname($_SERVER['PHP_SELF']) . "/test_actual_time.php\");\n" . "var tid = setInterval(testactualtime, 2500);\n" . "var seconds = 0;\n" . "function testactualtime() {\n" . "    \$.get( \"" . dirname($_SERVER['PHP_SELF']) . "/test_actual_time_wait.php?seconds=\" + seconds, function(data) {\n" . "        if (data == '') {\n" . "            data = 0;\n" . "        }\n" . "        if (parseInt(seconds) >= parseInt(data)) {\n" . "            \$('#value-{$cnt}').siblings('.loader').children().remove();\n" . "            \$('#value-{$cnt}').parent('tr').removeClass();\n" . "            if (parseInt(seconds) == parseInt({$time})) {\n" . "                \$('#value-{$cnt}').parent('tr').addClass('success');\n" . "            } else {\n" . "                \$('#value-{$cnt}').parent('tr').addClass('danger');\n" . "            }\n" . "            clearInterval(tid);\n" . "        } else {\n" . "            seconds = data;\n" . "            \$('#value-{$cnt}').html(seconds + ' s');\n" . "        }\n" . "    })\n" . "    .fail(function() {\n" . "        \$('#value-{$cnt}').html('No');\n" . "        \$('#value-{$cnt}').parent('tr').addClass('danger');\n" . "        clearInterval(tid);\n" . "    })\n" . "}\n";
     return array('value' => 0, 'postfix' => 's');
 }
Ejemplo n.º 2
0
$b->add('Pcntl', Server::Pcntl(), null, null, 'Checking pcntl.');
$b->add('Email Sending', Server::EmailSending(), null, null, 'Checking Messages.');
$b->add('Mcrypt', Server::Mcrypt(), null, null, 'Checking mcrypt.');
$b->add('Sockets', Server::Sockets(), null, null, 'Checking sockets.');
$b->add('PHP Regex', Server::PHPRegex(), null, null, 'Checking php regex.');
$b->add('Perl Regex', Server::PerlRegex(), null, null, 'Checking perl regex.');
$b->add('Zlib', Server::Zlib(), null, null, 'Checking zlib.');
$b->add('GDlib', Server::GDlib(), null, null, 'Checking gdlib.');
$b->add('Free Type', Server::FreeType(), null, null, 'Checking free type.');
$b->add('Mbstring', Server::Mbstring(), null, null, 'Checking mbstring.');
$b->add('PDO', Server::PDO(), null, null, 'Checking PDO');
$b->add('SimpleXML', Server::SimpleXML(), null, null, 'Checking SimpleXML');
$b->add('DOMDocument', Server::DOMDocument(), null, null, 'Checking DOMDocument');
$b->add('Curl', Server::Curl(), null, null, 'Checking Curl');
$b->add('Memory Limit', Server::MemoryLimit(), null, null, 'Checking Memory Limit');
$b->add('Max Execution Time', Server::MaxExecutionTime(), null, null, 'Checking Max Execution Time');
$b->add('Umask', Server::Umask(), null, null, 'Finds and returns the umask.');
$b->add('Post Max Size', Server::PostMaxSize(), null, null, 'Finds and returns the post max size.');
$b->add('Register Globals', Server::RegisterGlobals(), null, null, 'Checking Register Globals.');
$b->add('Display Errors', Server::DisplayErrors(), null, null, 'Checking Display Errors.');
$b->add('PHP File Uploads', Server::PHPFileUploads(), null, null, 'Checking PHPFileUploads.');
$b->add('Server Time', Server::ServerTime(), null, null, 'Returns the current server time.');
$b->addHeader('High Load.');
$b->add('Actual Memory Limit', HighLoad::ActualMemoryLimit(), 128, '>', 'Checks the actual memory limit.');
$b->add('Number Cpu Operations', HighLoad::NumberCpuOperations(), null, null, 'Number of operations of the CPU.');
$b->add('Number File Operations', HighLoad::NumberFileOperations(), null, null, 'Number of file operations.');
$b->add('Actual Execution Time', HighLoad::ActualExecutionTime(50), null, null, 'Checks real-time execution of the script.');
$b->add('Sending Big Emails', HighLoad::SendingBigEmails(), null, null, 'Checking the sending big emails.');
$b->add('Uploads Big File', HighLoad::UploadsBigFile(1000), null, null, 'Checking upload big files to the server.');
$b->addHeader('Http server.');
$b->add('Server', Http::Server(), null, null, 'Finds the current http server.');