PageRenderTime 44ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/quanta/code/trunk/administrator/components/com_quanta/install/install.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 155 lines | 24 code | 9 blank | 122 comment | 3 complexity | b9d5a749a8c3ca6e57caaba37bd67e61 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: install.php 377 2010-11-03 08:00:54Z eddieajau $
  4. * @package NewLifeInIT
  5. * @subpackage com_quanta
  6. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  8. * @link http://www.theartofjoomla.com
  9. */
  10. // no direct access
  11. defined('_JEXEC') or die;
  12. // Load the component language file
  13. $language = JFactory::getLanguage();
  14. $language->load('com_stone', JPATH_ADMINISTRATOR.'/components/com_stone');
  15. // PHP 5 check
  16. if (version_compare(PHP_VERSION, '5.2.4', '<')) {
  17. $this->parent->abort(JText::_('J_USE_PHP5'));
  18. return false;
  19. }
  20. // Include dependancies.
  21. require_once dirname(__FILE__).'/helper.php';
  22. require_once dirname(dirname(__FILE__)).'/version.php';
  23. // Install the modules.
  24. $modules = PackageInstallerHelper::installModules($this);
  25. if ($modules === false) {
  26. return false;
  27. }
  28. // Install the plugins.
  29. $plugins = PackageInstallerHelper::installPlugins($this);
  30. if ($plugins === false) {
  31. return false;
  32. }
  33. // Fix the link bug.
  34. PackageInstallerHelper::fixLink('com_stone');
  35. // Perform upgrades.
  36. /*
  37. if (PackageInstallerHelper::componentExists('com_stone')) {
  38. // Perform the DB upgrades.
  39. $results = PackageInstallerHelper::upgrade(
  40. '<?xml version="1.0"?>
  41. <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  42. <database name="">
  43. <table_structure name="#__stone_burials">
  44. <field Field="Deceased_ID" Type="varchar(50)" Null="NO" Key="PRI" Extra="" />
  45. <field Field="Family_Name" Type="varchar(50)" Null="YES" Key="MUL" Extra="" />
  46. <field Field="Given_Names" Type="varchar(100)" Null="YES" Key="MUL" Extra="" />
  47. <field Field="Gender" Type="varchar(10)" Null="YES" Key="" Extra="" />
  48. <field Field="Age_at_Death" Type="tinyint(3) unsigned" Null="NO" Key="" Default="0" Extra="" />
  49. <field Field="Age_Type" Type="varchar(10)" Null="YES" Key="" Extra="" />
  50. <field Field="Date_of_Birth" Type="date" Null="YES" Key="MUL" Extra="" />
  51. <field Field="Date_of_Death" Type="date" Null="YES" Key="MUL" Extra="" />
  52. <field Field="NOK_Last_Name" Type="varchar(50)" Null="YES" Key="" Extra="" />
  53. <field Field="NOK_First_Names" Type="varchar(100)" Null="YES" Key="" Extra="" />
  54. <field Field="Date_of_Burial" Type="date" Null="YES" Key="MUL" Extra="" />
  55. <field Field="Funeral_Home" Type="varchar(50)" Null="YES" Key="" Extra="" />
  56. <field Field="Undertaker_Last_Name" Type="varchar(50)" Null="YES" Key="" Extra="" />
  57. <field Field="Undertaker_First_names" Type="varchar(100)" Null="YES" Key="" Extra="" />
  58. <field Field="Internment_ID" Type="varchar(50)" Null="YES" Key="MUL" Extra="" />
  59. <field Field="Internment_Sequence" Type="int(10) unsigned" Null="NO" Key="" Extra="" />
  60. <field Field="Reference_Number" Type="varchar(50)" Null="YES" Key="" Extra="" />
  61. <field Field="Cemetery" Type="varchar(100)" Null="YES" Key="MUL" Extra="" />
  62. <field Field="Site_ID" Type="varchar(50)" Null="YES" Key="" Extra="" />
  63. <field Field="Location" Type="varchar(100)" Null="YES" Key="" Extra="" />
  64. <field Field="Cause_of_Death" Type="varchar(255)" Null="YES" Key="" Extra="" />
  65. <field Field="Head_Stone" Type="varchar(50)" Null="YES" Key="" Extra="" />
  66. <field Field="Head_Stone_Type" Type="varchar(50)" Null="YES" Key="" Extra="" />
  67. <field Field="Religion" Type="varchar(50)" Null="YES" Key="MUL" Extra="" />
  68. <field Field="Minister_Of_Religion_Last_Name" Type="varchar(50)" Null="YES" Key="" Extra="" />
  69. <field Field="Minister_Of_Religion_First_Names" Type="varchar(100)" Null="YES" Key="" Extra="" />
  70. <field Field="DeceasedPerson_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  71. <field Field="Expire_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  72. <field Field="Next_of_Kins_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  73. <field Field="NOK_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  74. <field Field="Internments_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  75. <field Field="FuneralService_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  76. <field Field="FuneralHome_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  77. <field Field="UnderTaker_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  78. <field Field="Inter_2_Site_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  79. <field Field="Sites_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  80. <field Field="Markers_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  81. <field Field="Officiating_Modified" Type="datetime" Null="YES" Key="" Extra="" />
  82. <field Field="Image_Path" Type="varchar(255)" Null="YES" Key="" Extra="" />
  83. <field Field="Image_File" Type="varchar(255)" Null="YES" Key="" Extra="" />
  84. <field Field="Service_Date" Type="date" Null="NO" Key="" Extra="" />
  85. <field Field="Service_Time" Type="time" Null="NO" Key="" Extra="" />
  86. <field Field="Maiden_Name" Type="varchar(100)" Null="YES" Key="MUL" Extra="" />
  87. <key Table="#__stone_burials" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="Deceased_ID" Collation="A" Null="" Index_type="BTREE" Comment="" />
  88. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_internment_id" Seq_in_index="1" Column_name="Internment_ID" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  89. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_cemetery" Seq_in_index="1" Column_name="Cemetery" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  90. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_Religion" Seq_in_index="1" Column_name="Religion" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  91. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_maiden_name" Seq_in_index="1" Column_name="Maiden_Name" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  92. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_family_name" Seq_in_index="1" Column_name="Family_Name" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  93. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_given_names" Seq_in_index="1" Column_name="Given_Names" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  94. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_date_of_birth" Seq_in_index="1" Column_name="Date_of_Birth" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  95. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_date_of_death" Seq_in_index="1" Column_name="Date_of_Death" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  96. <key Table="#__stone_burials" Non_unique="1" Key_name="idx_date_of_burial" Seq_in_index="1" Column_name="Date_of_Burial" Collation="A" Null="YES" Index_type="BTREE" Comment="" />
  97. </table_structure>
  98. </database>
  99. </mysqldump>'
  100. );
  101. // Log the upgrade.
  102. jimport('joomla.error.log');
  103. $user = JFactory::getUser();
  104. $userId = $user->get('id');
  105. $log = JLog::getInstance('com_stone.install.log.php');
  106. $log->setOptions(
  107. array(
  108. 'format' => "{DATE}\t{TIME}\t{USER_ID}\t{COMMENT}"
  109. )
  110. );
  111. if (empty($results)) {
  112. $log->addEntry(
  113. array(
  114. 'user_id' => $userId,
  115. 'comment' => 'Stone '.QuantaVersion::VERSION.'.'.QuantaVersion::SUBVERSION.' '.QuantaVersion::STATUS.' upgraded with no schema changes.'
  116. )
  117. );
  118. }
  119. else {
  120. $log->addEntry(
  121. array(
  122. 'user_id' => $userId,
  123. 'comment' => 'Stone '.QuantaVersion::VERSION.'.'.QuantaVersion::SUBVERSION.' '.QuantaVersion::STATUS.' upgraded with schema changes.'
  124. )
  125. );
  126. foreach ($results as $result)
  127. {
  128. $log->addEntry(
  129. array(
  130. 'user_id' => $userId,
  131. 'comment' => $result
  132. )
  133. );
  134. }
  135. }
  136. }
  137. */
  138. // Display the results.
  139. PackageInstallerHelper::displayInstalled(
  140. $modules,
  141. $plugins,
  142. JText::sprintf('COM_QUANTA_INSTALLED', QuantaVersion::VERSION.'.'.QuantaVersion::SUBVERSION.' '.QuantaVersion::STATUS)
  143. );