Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/spikephpcoverage/src/phpcoverage.remote.bottom.inc.php
Go to the documentation of this file.
00001 <?php
00002     die(); // This (unsecure MDL-26237) stuff isn't used by moodle at all
00003 /*
00004  *  $Id: phpcoverage.remote.bottom.inc.php,v 1.3 2011/02/02 13:20:28 moodlerobot Exp $
00005  *  
00006  *  Copyright(c) 2004-2006, SpikeSource Inc. All Rights Reserved.
00007  *  Licensed under the Open Software License version 2.1
00008  *  (See http://www.spikesource.com/license.html)
00009 */
00010 ?>
00011 <?php
00012 
00013     if(isset($_REQUEST)) {
00014         global $spc_config, $util;
00015         $logger = $util->getLogger();
00016 
00017         // Create a distinct hash (may or may not be unique)
00018         $session_id = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_NAME"]);
00019         $tmpFile = $util->getTmpDir() . "/phpcoverage.session." . $session_id;
00020         $logger->info("[phpcoverage.remote.bottom.inc.php] Session id: " . $session_id,
00021             __FILE__, __LINE__);
00022 
00023         if(!isset($cov)) {
00024             if(file_exists($tmpFile)) {
00025                 $object = file_get_contents($tmpFile);
00026                 $cov = unserialize($object);
00027                 $logger->info("[phpcoverage.remote.bottom.inc.php] Coverage object found: " . $cov, __FILE__, __LINE__);
00028             }
00029         }
00030 
00031         if(isset($cov)) {
00032             // PHPCoverage bottom half
00033             if(!isset($called_script)) {
00034                 $called_script = "";
00035             }
00036             $logger->info("[phpcoverage.remote.bottom.inc.php] END: " . $called_script,
00037                 __FILE__, __LINE__);
00038             // Save the code coverage
00039             $cov->saveCoverageXml();
00040             $logger->info("[phpcoverage.remote.bottom.inc.php] Saved coverage xml",
00041                 __FILE__, __LINE__);
00042             $cov->startInstrumentation();
00043             $logger->info("[phpcoverage.remote.bottom.inc.php] Instrumentation turned on.",
00044                 __FILE__, __LINE__);
00045             $object = serialize($cov);
00046             file_put_contents($tmpFile, $object);
00047             $logger->info("[phpcoverage.remote.bottom.inc.php] ################## END ###################",
00048                 __FILE__, __LINE__);
00049         }
00050     }
00051 
00052 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations