Permalink
Browse files

Changing Ak:: file methods calls to AkFileSystem

  • Loading branch information...
1 parent 1cc4ebd commit 7ba72f2a8728fdfabc31639137ab03fa88cfbe4c @bermi bermi committed May 2, 2010
Showing with 251 additions and 242 deletions.
  1. +2 −2 action_mailer/base.php
  2. +1 −1 action_mailer/composer.php
  3. +1 −1 action_mailer/mail_base.php
  4. +4 −4 action_mailer/parser.php
  5. +1 −1 action_pack/action_controller.php
  6. +2 −2 action_pack/helper_loader.php
  7. +1 −1 action_pack/helpers/ak_file_upload_helper.php
  8. +1 −1 action_pack/helpers/ak_menu_helper.php
  9. +1 −1 action_pack/php_code_sanitizer.php
  10. +1 −1 action_pack/php_template_handler.php
  11. +3 −3 action_pack/router/base.old.php
  12. +3 −3 action_pack/router/router_config.php
  13. +1 −1 active_record/associations/has_and_belongs_to_many.php
  14. +2 −2 active_record/database_schema_cache.php
  15. +3 −3 active_resource/http_client.php
  16. +17 −8 active_support/base.php
  17. +1 −1 active_support/cache/base.php
  18. +1 −1 active_support/config/base.php
  19. +2 −2 active_support/converters/excel_to_array.php
  20. +4 −4 active_support/converters/ms_excel_to_many.php
  21. +4 −4 active_support/converters/ms_word_to_many.php
  22. +4 −4 active_support/converters/xdoc_to_text.php
  23. +4 −4 active_support/core/class_extender.php
  24. +3 −3 active_support/generator.php
  25. +2 −2 active_support/i18n/locale_manager.php
  26. +2 −2 active_support/image/base.php
  27. +1 −1 active_support/image/color_scheme.php
  28. +1 −1 active_support/logger.php
  29. +6 −6 active_support/migrations/installer.php
  30. +2 −2 active_support/network/ftp.php
  31. +1 −1 active_support/plugin/base.php
  32. +6 −6 active_support/plugin/installer.php
  33. +11 −11 active_support/plugin/manager.php
  34. +1 −1 active_support/profiler.php
  35. +2 −2 active_support/testing/base.php
  36. +1 −1 active_support/testing/suite.php
  37. +1 −1 akelos_utils/generators/controller/controller_generator.php
  38. +1 −1 akelos_utils/generators/mailer/mailer_generator.php
  39. +5 −5 akelos_utils/makelos/makelos.php
  40. +2 −2 akelos_utils/makelos/tasks/akelos/create_app.task.php
  41. +3 −3 akelos_utils/makelos/tasks/doc/extract_metadata.task.php
  42. +1 −1 akelos_utils/makelos/tasks/release/generate.task.php
  43. +11 −11 akelos_utils/scripts/configure.php
  44. +1 −1 akelos_utils/scripts/migrate.php
  45. +1 −1 test/akelos/action_pack/cases/helpers/menu_helper.php
  46. +2 −2 test/akelos/action_pack/cases/locale_manager.php
  47. +1 −1 test/akelos/action_pack/cases/xml_rpc_web_service_api.php
  48. +2 −2 test/akelos/action_pack/lib/template_unit_test.php
  49. +1 −1 test/akelos/active_record/cases/association_finders.php
  50. +1 −1 test/akelos/active_record/cases/belongs_to.php
  51. +1 −1 test/akelos/active_record/cases/finder_return_types.php
  52. +1 −1 test/akelos/active_record/cases/finders.php
  53. +2 −2 test/akelos/active_record/cases/has_and_belongs_to_many.php
  54. +1 −1 test/akelos/active_record/cases/has_many_table_inheritance.php
  55. +1 −1 test/akelos/active_record/installers/property_installer.php
  56. +4 −4 test/akelos/active_support/cases/ak.php
  57. +9 −9 test/akelos/active_support/cases/config.php
  58. +34 −34 test/akelos/active_support/cases/file_handling.php
  59. +51 −51 test/akelos/active_support/cases/file_handling_over_ftp.php
  60. +1 −1 test/akelos/active_support/cases/generators.php
  61. +4 −4 test/akelos/active_support/cases/image.php
  62. +5 −5 test/akelos/active_support/cases/plugin_manager.php
  63. +1 −1 test/akelos/active_support/cases/unit_test.php
View
@@ -215,7 +215,7 @@
*
* $this->addAttachment(array(
* 'content_type' => 'image/jpeg',
-* 'body' => Ak::file_get_contents("an-image.jpg")));
+* 'body' => AkFileSystem::file_get_contents("an-image.jpg")));
*
* $this->addAttachment('application/pdf', generate_your_pdf_here());
* }
@@ -433,7 +433,7 @@ public function setSubject($subject) {
*
* $this->addAttachment(array(
* 'content_type' => 'image/jpeg',
- * 'body' => Ak::file_get_contents("an-image.jpg")));
+ * 'body' => AkFileSystem::file_get_contents("an-image.jpg")));
*
* $this->addAttachment('application/pdf', generate_your_pdf_here());
* }
@@ -229,7 +229,7 @@ protected function &_getPartsWithRenderedTemplates() {
protected function _getAvailableTemplates() {
$path = $this->ActionMailer->getTemplatePath();
if(!isset($templates[$path])){
- $templates[$path] = array_map('basename', Ak::dir($path, array('dirs'=>false)));
+ $templates[$path] = array_map('basename', AkFileSystem::dir($path, array('dirs'=>false)));
}
return $templates[$path];
}
@@ -391,7 +391,7 @@ public function hasNonAttachmentParts() {
* content-disposition set to "attachment".
*
* $this->setAttachment("image/jpg", array(
- * 'body' => Ak::file_get_contents('hello.jpg'),
+ * 'body' => AkFileSystem::file_get_contents('hello.jpg'),
* 'filename' => "hello.jpg"
* ));
*/
View
@@ -233,7 +233,7 @@ public function extractImagesIntoInlineParts(&$Mail, $options = array()) {
$image_name = Ak::uuid().'.'.$extenssion;
$html_images[$original_image_name] = 'cid:'.$image_name;
$Mail->setAttachment('image/'.$extenssion, array(
- 'body' => Ak::file_get_contents($image, array('base_path' => strstr($image, $app_dir) ? null : $tmp_dir)),
+ 'body' => AkFileSystem::file_get_contents($image, array('base_path' => strstr($image, $app_dir) ? null : $tmp_dir)),
'filename' => $image_name,
'content_disposition' => 'inline',
'content_id' => '<'.$image_name.'>',
@@ -438,7 +438,7 @@ protected function _extractCssRulesFromFile($path,$cssRules = false) {
$cssRules=array('id'=>array(),'class'=>array(),'element'=>array());
}
$path = $this->_getStylesheetPath($path);
- $contents = Ak::file_get_contents($path);
+ $contents = AkFileSystem::file_get_contents($path);
$cssRules=$this->_extractCssRulesFromContent($contents);
return $cssRules;
}
@@ -627,7 +627,7 @@ protected function _getStylesheetPath($path) {
}else{
$local_path = AK_TMP_DIR.DS.'mailer'.DS.'remote_css'.DS.md5($base_file_name['dirname']).DS.$base_file_name.'.'.$path_info['extension'];
if(!file_exists($local_path) || (time() > @filemtime($local_path)+7200)){
- if(!Ak::file_put_contents($local_path, Ak::url_get_contents($path))){
+ if(!AkFileSystem::file_put_contents($local_path, Ak::url_get_contents($path))){
return '';
}
}
@@ -653,7 +653,7 @@ protected function _getImagePath($path) {
}else{
$local_path = $tmp_dir.DS.'mailer'.DS.'remote_images'.DS.md5($path).DS.$base_file_name.'.'.$path_info['extension'];
if(!file_exists($local_path) || (time() > filemtime($local_path) + 7200)){
- if(!Ak::file_put_contents($local_path, Ak::url_get_contents($path), array('base_path' => $tmp_dir))){
+ if(!AkFileSystem::file_put_contents($local_path, Ak::url_get_contents($path), array('base_path' => $tmp_dir))){
return '';
}
@@ -1976,7 +1976,7 @@ public function sendFile($path, $options = array()) {
if(!empty($options['stream'])){
$this->render(array('text'=> new AkStream($path,$options['buffer_size'])));
}else{
- $this->render(array('text'=> Ak::file_get_contents($path)));
+ $this->render(array('text'=> AkFileSystem::file_get_contents($path)));
}
}
@@ -132,7 +132,7 @@ public function getDefaultHandlerHelperNames() {
$handler->helpers = !isset($handler->helpers) ? 'default' : $handler->helpers;
if($handler->helpers == 'default'){
- $available_helpers = Ak::dir(AK_ACTION_PACK_DIR.DS.'helpers',array('dirs'=>false));
+ $available_helpers = AkFileSystem::dir(AK_ACTION_PACK_DIR.DS.'helpers',array('dirs'=>false));
$helper_names = array();
foreach ($available_helpers as $available_helper){
$helper_names[$available_helper] = AkInflector::classify(substr($available_helper,0,-10));
@@ -151,7 +151,7 @@ public function getApplicationHelperNames() {
$helpers_dir = AkConfig::getDir('helpers');
$helper_names = array();
if ($handler->app_helpers == 'all'){
- $available_helpers = Ak::dir($helpers_dir, array('dirs'=>false));
+ $available_helpers = AkFileSystem::dir($helpers_dir, array('dirs'=>false));
$helper_names = array();
foreach ($available_helpers as $available_helper){
$helper_names[$helpers_dir.DS.$available_helper] = AkInflector::classify(substr($available_helper,0,-10));
@@ -86,7 +86,7 @@ public function _get_file_details($key) {
$key = preg_replace('/[^A-Z^a-z^0-9]/','',$key);
$file = $this->get_persisted_file($key);
if(!empty($file)){
- Ak::file_put_contents($this->_getTempDir().DS.'_file_uploader_file_'.$key, base64_decode($file['contents']), array('ftp'=>false));
+ AkFileSystem::file_put_contents($this->_getTempDir().DS.'_file_uploader_file_'.$key, base64_decode($file['contents']), array('ftp'=>false));
return array('tmp_name'=>$this->_getTempDir().DS.'_file_uploader_file_'.$key,'size'=>$file['size'], 'name'=>$file['name'],'type'=>$file['type'], 'error'=>0);
}else{
return false;
@@ -76,7 +76,7 @@ public function menu_for_controllers($menu_options = array(), $div_menu_id = 'me
public function _get_default_full_menu() {
$controllers_dir = AkConfig::getDir('controllers');
- $controller_file_names = array_map('array_pop', (array)Ak::dir($controllers_dir, array('files'=>false)));
+ $controller_file_names = array_map('array_pop', (array)AkFileSystem::dir($controllers_dir, array('files'=>false)));
sort($controller_file_names);
@@ -74,7 +74,7 @@ public function raiseError($code = null) {
'<h1>'.Ak::t('Template %template_file security error', array('%template_file'=>@$this->_options['file_path'])).':</h1>'.
"<ul><li>".join("</li>\n<li>",$this->getErrors())."</li></ul><hr />\n".
'<h2>'.Ak::t('Showing template source from %file:',array('%file'=>$this->_options['file_path'])).'</h2>'.
- (isset($this->_options['file_path']) ? '<pre>'.htmlentities(Ak::file_get_contents($this->_options['file_path'])).'</pre><hr />':'').
+ (isset($this->_options['file_path']) ? '<pre>'.htmlentities(AkFileSystem::file_get_contents($this->_options['file_path'])).'</pre><hr />':'').
'<h2>'.Ak::t('Showing compiled template source:').'</h2>'.highlight_string($code,true);
die();
@@ -153,7 +153,7 @@ public function _saveCompiledTemplate() {
if(defined('AK_UPLOAD_FILES_USING_FTP') && AK_UPLOAD_FILES_USING_FTP && !strstr($options['base_path'], AkConfig::getDir('base'))){
$options['ftp'] = false;
}
- Ak::file_put_contents($this->_getCompiledTemplatePath(), $this->_options['code'], $options);
+ AkFileSystem::file_put_contents($this->_getCompiledTemplatePath(), $this->_options['code'], $options);
}
@@ -670,7 +670,7 @@ public function loadUrlRewriteSettings() {
// In some cases where session.name cant be set up by htaccess file,
// we can check for modrewrite status on this file
}elseif (file_exists(AK_BASE_DIR.DS.'.htaccess')){
- $htaccess_file = Ak::file_get_contents(AK_BASE_DIR.DS.'.htaccess');
+ $htaccess_file = AkFileSystem::file_get_contents(AK_BASE_DIR.DS.'.htaccess');
if(stristr($htaccess_file,'RewriteEngine on')){
$url_rewrite_status = true;
}
@@ -687,8 +687,8 @@ public function loadUrlRewriteSettings() {
$url_rewrite_status = strstr(@file_get_contents($url_rewrite_test_url), 'AK_URL_REWRITE_ENABLED');
$AK_URL_REWRITE_ENABLED = "define(\\'AK_URL_REWRITE_ENABLED\\', ".($url_rewrite_status ? 'true' : 'false').");\n";
- register_shutdown_function(create_function('',"Ak::file_put_contents(AkConfig::getDir('config').DS.'config.php',
- str_replace('<?php\n','<?php\n\n$AK_URL_REWRITE_ENABLED',Ak::file_get_contents(AkConfig::getDir('config').DS.'config.php')));"));
+ register_shutdown_function(create_function('',"AkFileSystem::file_put_contents(AkConfig::getDir('config').DS.'config.php',
+ str_replace('<?php\n','<?php\n\n$AK_URL_REWRITE_ENABLED',AkFileSystem::file_get_contents(AkConfig::getDir('config').DS.'config.php')));"));
}
@@ -74,7 +74,7 @@ static function loadUrlRewriteSettings() {
// In some cases where session.name cant be set up by htaccess file,
// we can check for modrewrite status on this file
}elseif (file_exists(AK_BASE_DIR.DS.'.htaccess')){
- $htaccess_file = Ak::file_get_contents(AK_BASE_DIR.DS.'.htaccess');
+ $htaccess_file = AkFileSystem::file_get_contents(AK_BASE_DIR.DS.'.htaccess');
if(stristr($htaccess_file,'RewriteEngine on')){
$url_rewrite_status = true;
}
@@ -91,8 +91,8 @@ static function loadUrlRewriteSettings() {
$url_rewrite_status = strstr(@file_get_contents($url_rewrite_test_url), 'AK_URL_REWRITE_ENABLED');
$AK_URL_REWRITE_ENABLED = "define(\\'AK_URL_REWRITE_ENABLED\\', ".($url_rewrite_status ? 'true' : 'false').");\n";
- register_shutdown_function(create_function('',"Ak::file_put_contents(AkConfig::getDir('config').DS.'config.php',
- str_replace('<?php\n','<?php\n\n$AK_URL_REWRITE_ENABLED',Ak::file_get_contents(AkConfig::getDir('config').DS.'config.php')));"));
+ register_shutdown_function(create_function('',"AkFileSystem::file_put_contents(AkConfig::getDir('config').DS.'config.php',
+ str_replace('<?php\n','<?php\n\n$AK_URL_REWRITE_ENABLED',AkFileSystem::file_get_contents(AkConfig::getDir('config').DS.'config.php')));"));
}
if(!defined('AK_URL_REWRITE_ENABLED')){
@@ -239,7 +239,7 @@ public function {$options['join_class_name']}() {
}";
$class_file_code .= $class_code. "\n\n?>";
$join_file = AkInflector::toModelFilename($options['join_class_name']);
- if($this->_automatically_create_join_model_files && !file_exists($join_file) && @Ak::file_put_contents($join_file, $class_file_code)){
+ if($this->_automatically_create_join_model_files && !file_exists($join_file) && @AkFileSystem::file_put_contents($join_file, $class_file_code)){
require_once($join_file);
}else{
eval($class_code);
@@ -39,7 +39,7 @@ static function clearAll() {
$Logger = Ak::getLogger();
$Logger->message('Clearing all database settings from cache');
}
- Ak::rmdir_tree(AkDbSchemaCache::getCacheDir());
+ AkFileSystem::rmdir_tree(AkDbSchemaCache::getCacheDir());
}
static function get($key, $environment = AK_ENVIRONMENT) {
@@ -74,7 +74,7 @@ static function updateCacheFileAfterExecution($environment = null) {
$Logger->message('Updating database settings on '.$file_name);
}
- Ak::file_put_contents($file_name, serialize($config), array('base_path'=> AK_TMP_DIR));
+ AkFileSystem::file_put_contents($file_name, serialize($config), array('base_path'=> AK_TMP_DIR));
//file_put_contents($file_name, serialize($config));
} else if(AK_LOG_EVENTS){
@@ -164,7 +164,7 @@ public function setCookiePath($path) {
public function getPersistedCookie() {
if(file_exists(AkConfig::getDir('tmp').DS.$this->_cookie_path)){
- return Ak::file_get_contents($this->_cookie_path, array('base_path' => AkConfig::getDir('tmp')));
+ return AkFileSystem::file_get_contents($this->_cookie_path, array('base_path' => AkConfig::getDir('tmp')));
}
return false;
}
@@ -173,7 +173,7 @@ public function deletePersistedCookie() {
$path = $this->_cookie_path;
$this->_cookie_path = false;
if(file_exists(AkConfig::getDir('tmp').DS.$path)){
- Ak::file_delete($path, array('base_path' => AkConfig::getDir('tmp')));
+ AkFileSystem::file_delete($path, array('base_path' => AkConfig::getDir('tmp')));
return;
}
return false;
@@ -196,7 +196,7 @@ public function persistCookies() {
}
}
$cookie_string = trim(join($cookies, '; '));
- Ak::file_put_contents($this->_cookie_path, $cookie_string, array('base_path' => AkConfig::getDir('tmp')));
+ AkFileSystem::file_put_contents($this->_cookie_path, $cookie_string, array('base_path' => AkConfig::getDir('tmp')));
}
}
}
View
@@ -321,6 +321,7 @@ static function base_lang() {
* @uses AkFileSystem::dir
*/
static function dir($path, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::dir()');
return AkFileSystem::dir($path, $options);
}
@@ -329,6 +330,7 @@ static function dir($path, $options = array()) {
* @uses AkFileSystem::file_get_contents
*/
static function file_get_contents($file_name, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::file_get_contents()');
return AkFileSystem::file_get_contents($file_name, $options);
}
@@ -337,6 +339,7 @@ static function file_get_contents($file_name, $options = array()) {
* @uses AkFileSystem::file_put_contents
*/
static function file_put_contents($file_name, $content, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::file_put_contents()');
return AkFileSystem::file_put_contents($file_name, $content, $options);
}
@@ -345,6 +348,7 @@ static function file_put_contents($file_name, $content, $options = array()) {
* @uses AkFileSystem::file_add_contents
*/
static function file_add_contents($file_name, $content, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::file_add_contents()');
return AkFileSystem::file_add_contents($file_name, $content, $options);
}
@@ -353,6 +357,7 @@ static function file_add_contents($file_name, $content, $options = array()) {
* @uses AkFileSystem::file_delete
*/
static function file_delete($file_name, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::file_delete()');
return AkFileSystem::file_delete($file_name, $options);
}
@@ -361,6 +366,7 @@ static function file_delete($file_name, $options = array()) {
* @uses AkFileSystem::directory_delete
*/
static function directory_delete($dir_name, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::directory_delete()');
return AkFileSystem::directory_delete($dir_name, $options);
}
@@ -369,6 +375,7 @@ static function directory_delete($dir_name, $options = array()) {
* @uses AkFileSystem::make_dir
*/
static function make_dir($path, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::make_dir()');
return AkFileSystem::make_dir($path, $options);
}
@@ -377,6 +384,7 @@ static function make_dir($path, $options = array()) {
* @uses AkFileSystem::rmdir_tree
*/
static function rmdir_tree($directory) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::rmdir_tree()');
return AkFileSystem::rmdir_tree($directory);
}
@@ -385,6 +393,7 @@ static function rmdir_tree($directory) {
* @uses AkFileSystem::copy
*/
static function copy($origin, $target, $options = array()) {
+ Ak::deprecateMethod(__METHOD__, 'AkFileSystem::copy()');
return AkFileSystem::copy($origin, $target, $options);
}
@@ -913,7 +922,7 @@ static function compress($data, $format = 'gzip') {
$key = Ak::randomString(15);
$compressed_file = AK_TMP_DIR.DS.'d'.$key;
$uncompressed_file = AK_TMP_DIR.DS.'s'.$key;
- if(Ak::file_put_contents($uncompressed_file, $data, array('base_path'=>AK_TMP_DIR)) !== false){
+ if(AkFileSystem::file_put_contents($uncompressed_file, $data, array('base_path'=>AK_TMP_DIR)) !== false){
$compressed = gzopen($compressed_file,'w9');
$uncompressed = fopen($uncompressed_file, 'rb');
while(!feof($uncompressed)){
@@ -925,9 +934,9 @@ static function compress($data, $format = 'gzip') {
}else{
trigger_error(Ak::t('Could not write to temporary directory for generating compressed file using Ak::compress(). Please provide write access to %dirname', array('%dirname'=>AK_TMP_DIR)), E_USER_ERROR);
}
- $result = Ak::file_get_contents($compressed_file, array('base_path'=>AK_TMP_DIR));
- Ak::file_delete($compressed_file, array('base_path'=>AK_TMP_DIR));
- Ak::file_delete($uncompressed_file, array('base_path'=>AK_TMP_DIR));
+ $result = AkFileSystem::file_get_contents($compressed_file, array('base_path'=>AK_TMP_DIR));
+ AkFileSystem::file_delete($compressed_file, array('base_path'=>AK_TMP_DIR));
+ AkFileSystem::file_delete($uncompressed_file, array('base_path'=>AK_TMP_DIR));
return $result;
}
@@ -936,7 +945,7 @@ static function uncompress($compressed_data, $format = 'gzip') {
$compressed_file = AK_TMP_DIR.DS.'s'.$key;
$uncompressed_file = AK_TMP_DIR.DS.'d'.$key;
- if(Ak::file_put_contents($compressed_file, $compressed_data, array('base_path'=>AK_TMP_DIR)) !== false){
+ if(AkFileSystem::file_put_contents($compressed_file, $compressed_data, array('base_path'=>AK_TMP_DIR)) !== false){
$compressed = gzopen($compressed_file, "r");
$uncompressed = fopen($uncompressed_file, "w");
while(!gzeof($compressed)){
@@ -948,9 +957,9 @@ static function uncompress($compressed_data, $format = 'gzip') {
}else{
trigger_error(Ak::t('Could not write to temporary directory for generating uncompressing file using Ak::uncompress(). Please provide write access to %dirname', array('%dirname'=>AK_TMP_DIR)), E_USER_ERROR);
}
- $result = Ak::file_get_contents($uncompressed_file, array('base_path'=>AK_TMP_DIR));
- Ak::file_delete($uncompressed_file, array('base_path'=>AK_TMP_DIR));
- Ak::file_delete($compressed_file, array('base_path'=>AK_TMP_DIR));
+ $result = AkFileSystem::file_get_contents($uncompressed_file, array('base_path'=>AK_TMP_DIR));
+ AkFileSystem::file_delete($uncompressed_file, array('base_path'=>AK_TMP_DIR));
+ AkFileSystem::file_delete($compressed_file, array('base_path'=>AK_TMP_DIR));
return $result;
}
Oops, something went wrong.

0 comments on commit 7ba72f2

Please sign in to comment.