PageRenderTime 51ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/install/components/FileSystemCheck.php

https://github.com/mojo97/eduku
PHP | 140 lines | 100 code | 9 blank | 31 comment | 2 complexity | 6420054ab8e5520f63af4b141bd937f9 MD5 | raw file
  1. <?php
  2. /**
  3. * BackendPro
  4. *
  5. * An open source development control panel written in PHP
  6. *
  7. * @package BackendPro
  8. * @author Adam Price
  9. * @copyright Copyright (c) 2008, Adam Price
  10. * @license http://www.gnu.org/licenses/lgpl.html
  11. * @link http://www.kaydoo.co.uk/projects/backendpro
  12. * @filesource
  13. */
  14. // ------------------------------------------------------------------------
  15. include_once("common/CommonFunctions.php");
  16. /**
  17. * Log folder is writable
  18. *
  19. * Check the log folder is writable
  20. *
  21. * @package BackendPro
  22. * @subpackage Install
  23. */
  24. class LogFolderWritable extends Component
  25. {
  26. var $name = "Log Folder writable";
  27. function install()
  28. {
  29. if( is_really_writable(LOGS))
  30. {
  31. $this->status = TRUE;
  32. }
  33. else
  34. {
  35. $this->error = LOGS . " folder isn't writable";
  36. }
  37. return $this->status;
  38. }
  39. }
  40. /**
  41. * Asset folders are writable
  42. *
  43. * Check all the asset folders are writable
  44. *
  45. * @package BackendPro
  46. * @subpackage Install
  47. */
  48. class AssetFoldersWritable extends Component
  49. {
  50. var $name = "Asset folders writable";
  51. var $path_array = array(
  52. 'assets/cache/');
  53. function install()
  54. {
  55. foreach($this->path_array as $path)
  56. {
  57. if ( ! is_really_writable(BASEPATH . $path))
  58. {
  59. $this->error = BASEPATH . $path . " folder isn't writable";
  60. return $this->status;
  61. }
  62. }
  63. $this->status = TRUE;
  64. return $this->status;
  65. }
  66. }
  67. /**
  68. * Cache folder is writable
  69. *
  70. * Check the CodeIgniter cache folder is writable
  71. *
  72. * @package BackendPro
  73. * @subpackage Install
  74. */
  75. class CacheFolderWritable extends Component
  76. {
  77. var $name = "Cache Folder writable";
  78. function install()
  79. {
  80. if( is_really_writable(CACHE))
  81. {
  82. $this->status = TRUE;
  83. }
  84. else
  85. {
  86. $this->error = CACHE . " folder isn't writable";
  87. }
  88. return $this->status;
  89. }
  90. }
  91. /**
  92. * Config files are writable
  93. *
  94. * Check all config files we need to write to later
  95. * are writable
  96. *
  97. * @package BackendPro
  98. * @subpackage Install
  99. */
  100. class ConfigFilesWritable extends Component
  101. {
  102. var $name = "Config files writable";
  103. var $file_array = array();
  104. function ConfigFilesWritable()
  105. {
  106. $this->file_array[] = APPLICATION . 'config/config.php';
  107. $this->file_array[] = APPLICATION . 'config/database.php';
  108. $this->file_array[] = MODULES . 'recaptcha/config/recaptcha.php';
  109. }
  110. function install()
  111. {
  112. foreach($this->file_array as $file)
  113. {
  114. if ( !is_really_writable($file))
  115. {
  116. $this->error = $file . " file isn't writable";
  117. return $this->status;
  118. }
  119. }
  120. $this->status = TRUE;
  121. return $this->status;
  122. }
  123. }
  124. /* End of file FileSystemCheck.php */
  125. /* Location: ./install/components/FileSystemCheck.php */