PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms 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// ------------------------------------------------------------------------
 16
 17include_once("common/CommonFunctions.php");
 18
 19/**
 20 * Log folder is writable
 21 *
 22 * Check the log folder is writable
 23 *
 24 * @package 	BackendPro
 25 * @subpackage 	Install
 26 */
 27class LogFolderWritable extends Component
 28{
 29	var $name = "Log Folder writable";
 30
 31	function install()
 32	{
 33		if( is_really_writable(LOGS))
 34		{
 35			$this->status = TRUE;
 36		}
 37		else
 38		{
 39			$this->error = LOGS . " folder isn't writable";
 40		}
 41
 42		return $this->status;
 43	}
 44}
 45
 46/**
 47 * Asset folders are writable
 48 *
 49 * Check all the asset folders are writable
 50 *
 51 * @package 	BackendPro
 52 * @subpackage 	Install
 53 */
 54class AssetFoldersWritable extends Component
 55{
 56	var $name = "Asset folders writable";
 57	var $path_array = array(
 58			'assets/cache/');
 59
 60	function install()
 61	{
 62		foreach($this->path_array as $path)
 63		{
 64			if ( ! is_really_writable(BASEPATH . $path))
 65			{
 66				$this->error = BASEPATH . $path . " folder isn't writable";
 67				return $this->status;
 68			}
 69		}
 70		$this->status = TRUE;
 71		return $this->status;
 72	}
 73}
 74
 75/**
 76 * Cache folder is writable
 77 *
 78 * Check the CodeIgniter cache folder is writable
 79 *
 80 * @package 	BackendPro
 81 * @subpackage 	Install
 82 */
 83class CacheFolderWritable extends Component
 84{
 85	var $name = "Cache Folder writable";
 86
 87	function install()
 88	{
 89		if( is_really_writable(CACHE))
 90		{
 91			$this->status = TRUE;
 92		}
 93		else
 94		{
 95			$this->error = CACHE . " folder isn't writable";
 96		}
 97		return $this->status;
 98	}
 99}
100
101/**
102 * Config files are writable
103 *
104 * Check all config files we need to write to later
105 * are writable
106 *
107 * @package 	BackendPro
108 * @subpackage 	Install
109 */
110class ConfigFilesWritable extends Component
111{
112	var $name = "Config files writable";
113	var $file_array = array();
114
115	function ConfigFilesWritable()
116	{
117		$this->file_array[] = APPLICATION . 'config/config.php';
118		$this->file_array[] = APPLICATION . 'config/database.php';
119		$this->file_array[] = MODULES . 'recaptcha/config/recaptcha.php';
120	}
121
122	function install()
123	{
124		foreach($this->file_array as $file)
125		{
126			if ( !is_really_writable($file))
127			{
128				$this->error = $file . " file isn't writable";
129				return $this->status;
130			}
131		}
132		$this->status = TRUE;
133		return $this->status;
134	}
135}
136
137
138
139/* End of file FileSystemCheck.php */
140/* Location: ./install/components/FileSystemCheck.php */