站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
建站程序
开发
服务器
办公软件
开发教程
服务器教程
软件使用教程
运营教程
热门电子书
WordPress教程
宝塔面板教程
CSS教程
Shopify教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
用户:Valiant
”
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
用户账号“Valiant”没有注册。请在创建或编辑本页前检查。
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
==TODO== ===Embedding and Integration=== See the [[Gallery:Embedding_Development_Roadmap|Embedding Development Roadmap]]. Next on the list are: * polishing and committing the embed/ module (user synchronization) ===Other=== * Merge checkout module with G2 cart module into a single more powerful module * continue work on [http://sourceforge.net/pm/task.php?func=detailtask&project_task_id=117107&group_id=7130&group_project_id=14056 task #14056 Move max. nr of SQL IN (id1,id2, ..) markers from API to DB] * Move "[http://gallery.menalto.com/node/35733#comment-130428 Howto change a standalone into a multisite G2]" docs to codex * Installer / upgrader system checks step: file integrity: prevent advancing if file integrity check fails, offer a "ignore" option * Improving email / domain validators in G2 (based on RFCs, probably updating the PEAR libs Mail and Net_IDNA) * Clean up and finish the mplayer module -- http://gallery.menalto.com/node/40548#comment-153952 * [http://gallery.menalto.com/node/30045 Mysql delete from table_name bug vs truncate] (no priority anymore) === GalleryCoreApi::requireOnce === * We found out that the "10x faster" claim for our $loaded[$file] require_once wrapper cannot be reproduced * An interesting approach would be to just change the include_path right at the beginning in GalleryInitFirstPass and add the gallery2 directory and gallery2/plugins to the include path. Then, we could use a plain require_once instead of GalleryCoreApi::requireOnce (about 15% faster) * But the include_path can only be changed with ini_set (and since 4.3.0 with a dedicated function), so if we can't change the include_path successfully, we still need our GalleryCoreApi::requireOnce wrapper and this is the greatest common denominator. We need to support this case * So we're back to using GalleryCoreApi::requireOnce and in this function, we'd like to use require_once directly if the include_path has been changed and our old mechanism with getPluginDir etc if the include path wasn't changed * The "has the include path been changed" check should be as cheap as a if ($staticVar) check, since we're talking about a highly optimized function (maybe check the performance difference between GDC::containsKey) * A static var would be bad for testability (unless we use another parameter to set/reset this var) * If possible, we don't want to add an additional parameter to requireOnce to set/reset this static var * In GalleryInitFirstPass, we'd have to first change the include_path and then requireOnce all the files (unless we use a GDC var which we can reset) * don't forget about embedded G2, where we need to add the gallery2 folder to the include path and can't just replace the include_path * In the end, we'll have to see if the resulting function would be faster than this optimized version (since all the checks etc would render it a little slower): function requireOnce($file, $skipBaseDirectoryDetection=false) { static $loaded, $galleryBaseDir; if (strpos($file, '..') !== false) { return; } if (!isset($loaded[$file])) { if ($skipBaseDirectoryDetection || !strncmp($file, 'lib', 3)) { if (empty($galleryBaseDir)) { $galleryBaseDir = GALLERY_CONFIG_DIR . '/'; } require_once($galleryBaseDir . $file); } else { if (!preg_match('/^(module|theme)s\/(.+)\/.+/iU', $file, $pluginData)) { print('Invalid path: ' . $file); return; } require_once(GalleryCoreApi::getPluginBaseDir($pluginData[1], $pluginData[2]) . $file); } $loaded[$file] = 1; } } A prototype of setting / checking include_path: In init.inc GalleryInitFirstpass: /* Add the plugins dir to the include path */ $includePath = @ini_get('include_path'); if (substr($includePath, -1) != PATH_SEPARATOR) { $includePath .= PATH_SEPARATOR; } $includePath .= GALLERY_CONFIG_DIR . PATH_SEPARATOR . GALLERY_CONFIG_DIR . DIRECTORY_SEPARATOR . 'plugins'; @ini_set('include_path', $includePath); In requireOnce before the if (isset($loaded[$file])) { check: if (!empty($includePathChanged)) { return require_once($file); } else if (!isset($includePathChanged)) { global $gallery; if (strpos(@ini_get('include_path'), PATH_SEPARATOR . GALLERY_CONFIG_DIR === false)) { $includePathChanged = false; } else { $includePathChanged = true; } } Issues: * static var -> can't test both cases * performance not yet compared with optimized requireOnce and pure require_once, but the improvement would be very small anyway Bottom line: * The approach with changing include_path would have been very elegant and the performance would have been improved (by maybe 50 micro seconds * nr of files includes per request) * But since we must deal with hosts that can't change the include_path during runtime, we can't call require_once directly and we need to check on each require_once call whether to use require_once directly or our low-tech method. We will see if it's worth it. * see http://gallery.pastebin.com/459591
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)