summaryrefslogtreecommitdiff
path: root/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-03 11:40:43 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-03 11:40:43 +0000
commit4c1215ca04bc682a5165363724a69f9a557304de (patch)
tree5f0402f4f7b07e5a34ad692bcb47828b30c9fa11 /poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
parent688d58f51120786b099509ea3785a8057ae36265 (diff)
download2012-php-weave-4c1215ca04bc682a5165363724a69f9a557304de.tar.gz
2012-php-weave-4c1215ca04bc682a5165363724a69f9a557304de.tar.bz2
2012-php-weave-4c1215ca04bc682a5165363724a69f9a557304de.zip
Etape 2 sur 6743542 : parsing et tentative de mise en cache des AST des ficheir de tout le framework.
Avec dumpAST : 4m37 d'exec. Avec serializeAST : 3m30 mais tous les fichiers sont vides car json_encode n'encode pas les objets !!! git-svn-id: file:///var/svn/2012-php-weave/trunk@11 d972a294-176a-4cf9-8ea1-fcd5b0c30f5c
Diffstat (limited to 'poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php')
-rw-r--r--poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
index 508e509..5e4f7de 100644
--- a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
+++ b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
@@ -14,20 +14,30 @@ class CakePHPWeaver extends AbstractWeaver {
$fw_props=$this->staticEvalDefine($entrypoint_ast, $magics);
if (!is_array($fw_props)) throw new Exception("No properties found in '$entrypoint_path'");
- print_r($fw_props);
+// print_r($fw_props);
$required=array('ROOT','APP_DIR','CAKE_CORE_INCLUDE_PATH','WEBROOT_DIR', 'WWW_ROOT');
$missing=array_diff($required, array_keys($fw_props));
- print_r($missing);
+// print_r($missing);
assert('count($missing)===0;');
return array_merge(array('entrypoint_path' => $entrypoint_path), $fw_props);
}
public function parseFrameworkConfig($fw_props) {
-
+ return array();
}
public function parseFrameworkCode($fw_props, $fw_conf, $cache_path) {
-
+ $filelist=$this->findAllFiles($fw_props['CAKE_CORE_INCLUDE_PATH'], '/(\.php|\.ctp)$/', '/^\.svn$/');
+ //print_r($filelist);
+
+ $env=$fw_props; //TODO : More things here ?
+ foreach ($filelist as $f) {
+ //TODO : cache match
+ $cache_filepath=$cache_path . "/" . sha1($f) . "-" . substr(sha1(print_r($env,true)),-8,8) . ".ast";
+
+ $ast=$this->parseAndWalk($f, null, $env);
+ $this->serializeAST($ast, $f, $cache_filepath);
+ }
}
public function parseApplicationCode($fw_props, $fw_conf, $fw_extra, $cache_path) {