Cheetah
installer.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . "ChWsbInstaller.php");
9 
11 {
12  return preg_match ('/\/[a-z]+_[a-z]+$/', $s);
13 }
14 
16 {
18  {
19  parent::__construct($aConfig);
20  $this->_aActions = array_merge($this->_aActions, array(
21  'check_requirements' => array(
22  'title' => 'Check Orca Forum requrements',
23  ),
24  ));
25  }
26 
27  function uninstall($aParams)
28  {
29  $ret = parent::uninstall($aParams);
30 
31  $sPath = CH_DIRECTORY_PATH_MODULES . 'cheetah/forum/';
32 
33  $a = $this->_read_in_dir ("{$sPath}cachejs/", 'is_file');
34  array_walk($a, array($this, '_unlink'));
35 
36  $a = $this->_read_in_dir ("{$sPath}classes/", 'is_dir');
37  array_walk($a, array($this, '_rmdir_rf'));
38 
39  $a = $this->_read_in_dir ("{$sPath}conf/", 'is_file');
40  array_walk($a, array($this, '_unlink'));
41 
42  $a = $this->_read_in_dir ("{$sPath}js/", 'is_dir');
43  array_walk($a, array($this, '_rmdir_rf'));
44 
45  $a = $this->_read_in_dir ("{$sPath}log/", 'is_file');
46  array_walk($a, array($this, '_unlink'));
47 
48  $a = $this->_read_in_dir ("{$sPath}layout/", 'is_compiled_template');
49  array_walk($a, array($this, '_rmdir_rf'));
50 
51  return $ret;
52  }
53 
54  function _read_in_dir ($sDir, $sFunc)
55  {
56  $aRet = array ();
57  if ($h = opendir($sDir)) {
58  while (false !== ($sFile = readdir($h))) {
59  if ($sFile != '.' && $sFile != '..' && $sFile[0] != '.' && $sFunc($sDir.$sFile)) {
60  $aRet[] = $sDir.$sFile;
61  }
62  }
63  closedir($h);
64  }
65  return $aRet;
66  }
67 
68  function _rmdir_rf($dirname)
69  {
70  if ($dirHandle = opendir($dirname)) {
71  chdir($dirname);
72  while ($file = readdir($dirHandle)) {
73  if ($file == '.' || $file == '..') continue;
74  if (is_dir($file)) $this->_rmdir_rf($file);
75  else unlink($file);
76  }
77  chdir('..');
78  closedir($dirHandle);
79  @rmdir($dirname);
80  }
81  }
82 
83  function _unlink($s)
84  {
85  unlink ($s);
86  }
87 
89  {
90  $iErrors = 0;
91  if (((int)phpversion()) >= 5) { // PHP 5
92  $iErrors += (class_exists('XsltProcessor')) ? 0 : 1;
93  } else { // PHP 4
94  $iErrors += (function_exists('domxml_xslt_stylesheet_file')) ? 0 : 1;
95  $iErrors += (function_exists('xslt_create')) ? 0 : 1;
96  }
97  return array('code' => !$iErrors ? CH_WSB_INSTALLER_SUCCESS : CH_WSB_INSTALLER_FAILED, 'content' => '');
98  }
99 
101  {
102  return '
103  <div style="border:1px solid red; padding:10px;">
104 
105  Orca requres PHP XSLT extension. Please enable it first then proceed with installation.
106 
107  <br /><br />
108 
109  For <u>PHP4</u>, make sure that PHP is compiled with the following extensions:
110  <pre>
111  --with-dom --enable-xslt --with-xslt-sablot
112  </pre>
113  If these PHP extensions are enabled, then you can see <u>domxml</u> and <u>xslt</u> extensions in phpinfo() with the following options:
114  <pre>
115  DOM/XML: enabled
116  XSLT support: enabled
117  </pre>
118 
119  <br /><br />
120 
121  For <u>PHP5</u>, make sure that PHP is compiled with the following extension:
122  <pre>
123  --with-xsl
124  </pre>
125  If this PHP extension is enabled, then you can see <u>xslt</u> extensions in phpinfo() with the following option:
126  <pre>
127  XSLT support: enabled
128  </pre>
129  </div>';
130  }
131 }
$ret
$ret
Definition: index.php:39
php
ChWsbInstaller
Definition: ChWsbInstaller.php:38
is_compiled_template
is_compiled_template($s)
Definition: installer.php:10
$sFile
$sFile
Definition: index.php:20
ChOrcaInstaller\_read_in_dir
_read_in_dir($sDir, $sFunc)
Definition: installer.php:54
ChOrcaInstaller\actionCheckRequirements
actionCheckRequirements()
Definition: installer.php:88
ChOrcaInstaller\actionCheckRequirementsFailed
actionCheckRequirementsFailed()
Definition: installer.php:100
CH_WSB_INSTALLER_FAILED
const CH_WSB_INSTALLER_FAILED
Definition: ChWsbInstaller.php:15
ChOrcaInstaller\__construct
__construct($aConfig)
Definition: installer.php:17
$aConfig
$aConfig
Definition: config.php:8
$s
$s
Definition: embed.php:13
ChOrcaInstaller
Definition: installer.php:16
ChOrcaInstaller\uninstall
uninstall($aParams)
Definition: installer.php:27
CH_WSB_INSTALLER_SUCCESS
const CH_WSB_INSTALLER_SUCCESS
Definition: ChWsbInstaller.php:14
ChOrcaInstaller\_rmdir_rf
_rmdir_rf($dirname)
Definition: installer.php:68
ChOrcaInstaller\_unlink
_unlink($s)
Definition: installer.php:83