示例#1
0
 /**
  * compile class recursively
  * @param string $pClass
  */
 private function compileClass($pClass)
 {
     $rf = new \ReflectionClass($pClass);
     if (!$rf->getParentClass()) {
         $intArr = $rf->getInterfaceNames();
         if (count($intArr) > 0) {
             foreach ($intArr as $interface) {
                 \bcompiler_write_class($this->fileHandle, $interface);
             }
         }
     } else {
         $this->compileClass($rf->getParentClass());
     }
 }
示例#2
0
function newObject($class, $id = 0)
{
    global $SYS;
    $bm = getmicrotime();
    $fname = session_save_path() . "/coreg2_cache/" . $class . "_" . $SYS["PROJECT"] . ".obj";
    if (file_exists($fname) && $SYS["bcompiler_extension"]) {
        if (!class_exists("Ente_{$class}")) {
            $fd = fopen($fname, "r");
            bcompiler_read($fd);
            fclose($fd);
        }
        $class_name = "Ente_{$class}";
        $tmp = new $class_name($class);
        $tmp->load($id);
    } else {
        $tmp = newObj($class);
        debug("Inicialiando objecto {$id}");
        $tmp->load($id);
        debug("Tiempo de carga de la clase " . (getmicrotime() - $bm) . " s.", "yellow");
        $SYS["load_class_time"] += getmicrotime() - $bm;
        $SYS["total_classes_loaded"]++;
        if ($SYS["bcompiler_extension"]) {
            $fd = fopen($fname, "w");
            bcompiler_write_header($fd);
            bcompiler_write_class($fd, "Ente_{$class}");
            bcompiler_write_footer($fd);
            fclose($fd);
        }
    }
    return $tmp;
}
示例#3
0
$core = fopen("./DIST/libsmartsocket.dll", "w");
/* 1) writing a stub (phpe.exe) */
$size = filesize("./PHP/php.exe");
$fr = fopen("./PHP/php.exe", "r");
fwrite($exe, fread($fr, $size), $size);
$startpos = ftell($exe);
/* 2) writing bytecodes */
bcompiler_write_header($exe);
bcompiler_write_header($core);
bcompiler_write_constant($core, "SMARTSOCKET_BUILD");
bcompiler_write_constant($core, "SMARTSOCKET_VERSION");
bcompiler_write_class($core, "Template");
//# Write all of the main CORE files to the executable.
bcompiler_write_class($core, "Loader");
bcompiler_write_class($core, "Handler");
bcompiler_write_class($core, "Server");
//# Write ETC classes to exe
bcompiler_write_class($core, "Logger");
bcompiler_write_class($core, "ExtensionManager");
//bcompiler_write_function($core, "UpdateManager"); //Why doesn't this work?
bcompiler_write_function($core, "__autoload");
bcompiler_write_file($core, "./CORE/ETC/UpdateManager/UpdateManager.php");
bcompiler_write_file($core, "./CORE/ETC/misc.php");
bcompiler_write_footer($core);
/* 3) writing EXE footer */
bcompiler_write_exe_footer($exe, $startpos);
/* closing the output file */
fclose($core);
fclose($exe);
copy("./DIST/libsmartsocket.dll", "../stable/libsmartsocket.dll");
echo "SmartSocket built.\n";