cs-project-svn_notify Mailing List for CS-Project (Page 6)
Brought to you by:
crazedsanity
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(65) |
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(34) |
Feb
(82) |
Mar
(21) |
Apr
(12) |
May
(16) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(5) |
Sep
(12) |
Oct
(11) |
Nov
(4) |
Dec
(15) |
2010 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <cra...@us...> - 2009-02-03 18:52:36
|
Revision: 916 http://cs-project.svn.sourceforge.net/cs-project/?rev=916&view=rev Author: crazedsanity Date: 2009-02-03 18:52:28 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Minor class and file name changes to match new versions of external libs. Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php trunk/1.2/lib/upgradeClass.php Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2009-02-03 18:51:29 UTC (rev 915) +++ trunk/1.2/lib/config.class.php 2009-02-03 18:52:28 UTC (rev 916) @@ -16,7 +16,7 @@ //------------------------------------------------------------------------- public function __construct($fileName=NULL) { $this->gf = new cs_globalFunctions(); - $this->fs = new cs_fileSystemClass(dirname(__FILE__) .'/..'); + $this->fs = new cs_fileSystem(dirname(__FILE__) .'/..'); $this->fileName = dirname(__FILE__) .'/'. CONFIG_FILENAME; if(!is_null($fileName) && strlen($fileName)) { @@ -51,7 +51,7 @@ $xmlString = $this->fs->read($this->fileName); //parse the file. - $xmlParser = new xmlParser($xmlString); + $xmlParser = new cs_phpxmlParser($xmlString); if($simple) { $config = $xmlParser->get_tree(TRUE); Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2009-02-03 18:51:29 UTC (rev 915) +++ trunk/1.2/lib/site_config.php 2009-02-03 18:52:28 UTC (rev 916) @@ -16,12 +16,12 @@ require(dirname(__FILE__) .'/abstractClasses/dbAbstract.class.php'); require(dirname(__FILE__) .'/session_class.php'); require(dirname(__FILE__) .'/upgradeClass.php'); -require_once(dirname(__FILE__) .'/cs-content/cs_phpDB.php'); -require_once(dirname(__FILE__) .'/cs-content/contentSystemClass.php'); -require_once(dirname(__FILE__) .'/cs-content/cs_fileSystemClass.php'); -require_once(dirname(__FILE__) .'/cs-phpxml/xmlCreatorClass.php'); -require_once(dirname(__FILE__) .'/cs-phpxml/xmlParserClass.php'); -require_once(dirname(__FILE__) .'/cs-content/cs_globalFunctions.php'); +require_once(dirname(__FILE__) .'/cs-content/cs_phpDB.class.php'); +require_once(dirname(__FILE__) .'/cs-content/contentSystem.class.php'); +require_once(dirname(__FILE__) .'/cs-content/cs_fileSystem.class.php'); +require_once(dirname(__FILE__) .'/cs-phpxml/cs_phpxmlCreator.class.php'); +require_once(dirname(__FILE__) .'/cs-phpxml/cs_phpxmlParser.class.php'); +require_once(dirname(__FILE__) .'/cs-content/cs_globalFunctions.class.php'); require_once(dirname(__FILE__) .'/config.class.php'); define(CONFIG_FILENAME, 'config.xml'); Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2009-02-03 18:51:29 UTC (rev 915) +++ trunk/1.2/lib/upgradeClass.php 2009-02-03 18:52:28 UTC (rev 916) @@ -36,7 +36,7 @@ //========================================================================= public function __construct() { - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../'); + $this->fsObj = new cs_fileSystem(dirname(__FILE__) .'/../'); $this->gfObj = new cs_globalFunctions; $this->gfObj->debugPrintOpt = DEBUGPRINTOPT; clearstatcache(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 18:51:34
|
Revision: 915 http://cs-project.svn.sourceforge.net/cs-project/?rev=915&view=rev Author: crazedsanity Date: 2009-02-03 18:51:29 +0000 (Tue, 03 Feb 2009) Log Message: ----------- First round of updates to cope with new versions of external libs. /lib/globalFunctions.php: * get_required_external_lib_versions(): -- changed some class names. -- changed required versions: + cs-content: 1.0.0-ALPHA3 + cs-phpxml: 1.0.0-ALPHA2 + cs-arrayToPath: 1.0.0 * check_external_lib_versions(): -- do the get_project() and get_version() calls in a try/catch block -- if an exception is caught, throw another exception to more easily find & fix the problem encountered. Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2009-02-03 17:31:32 UTC (rev 914) +++ trunk/1.2/lib/globalFunctions.php 2009-02-03 18:51:29 UTC (rev 915) @@ -17,9 +17,9 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '0.10.12'), - 'XMLParser' => array('cs-phpxml', '0.5.6'), - 'arrayToPath' => array('cs-arrayToPath', '0.2.2') + 'contentSystem' => array('cs-content', '1.0.0-ALPHA3'), + 'cs_phpxmlParser' => array('cs-phpxml', '1.0.0-ALPHA2'), + 'cs_arrayToPath' => array('cs-arrayToPath', '1.0.0') ); if(!is_null($projectName)) { @@ -61,8 +61,13 @@ if($obj->isTest === TRUE) { //okay, get version & project names. if(method_exists($obj, 'get_version') && method_exists($obj, 'get_project')) { - $realVersion = $obj->get_version(); - $realProject = $obj->get_project(); + try { + $realVersion = $obj->get_version(); + $realProject = $obj->get_project(); + } + catch(exception $e) { + throw new exception(__METHOD__ .": unable to get project name or version for (". $className ."), DETAILS::: ". $e->getMessage()); + } if($realVersion === $matchVersion && $realProject === $matchProject) { //all looks good. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-02-03 17:31:35
|
Revision: 914 http://cs-project.svn.sourceforge.net/cs-project/?rev=914&view=rev Author: crazedsanity Date: 2009-02-03 17:31:32 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Fix problem with typecasts (not a problem in PostgreSQL v8.2.5)(issue #234). /lib/mainRecordClass.php: * get_records(): -- specifically when retrieving parent records, the "record_id" is cast as text (since ancestry is text) to avoid a database error. Modified Paths: -------------- trunk/1.2/lib/mainRecordClass.php Modified: trunk/1.2/lib/mainRecordClass.php =================================================================== --- trunk/1.2/lib/mainRecordClass.php 2009-01-07 18:15:53 UTC (rev 913) +++ trunk/1.2/lib/mainRecordClass.php 2009-02-03 17:31:32 UTC (rev 914) @@ -94,7 +94,7 @@ if(is_numeric($parent)) { if($parent == 0) { // - $critArr['ancestry'] = "=record_id"; + $critArr['ancestry'] = "=record_id::text"; } else { //tricksie things to facilitate a 'like' search. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2009-01-07 18:15:57
|
Revision: 913 http://cs-project.svn.sourceforge.net/cs-project/?rev=913&view=rev Author: crazedsanity Date: 2009-01-07 18:15:53 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Credits file, so people know who is developing/contributing to the project. NOTE: this may need to be updated to include others... I just copied it from another project. Added Paths: ----------- trunk/1.2/CREDITS Added: trunk/1.2/CREDITS =================================================================== --- trunk/1.2/CREDITS (rev 0) +++ trunk/1.2/CREDITS 2009-01-07 18:15:53 UTC (rev 913) @@ -0,0 +1,3 @@ + +Lead Developer: Dan Falconer (cra...@us...) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-28 04:24:54
|
Revision: 912 http://cs-project.svn.sourceforge.net/cs-project/?rev=912&view=rev Author: crazedsanity Date: 2008-08-28 04:24:51 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Visibility issue for associated users on project view. Modified Paths: -------------- releases/1.2/templates/content/project/view/index.content.tmpl Property Changed: ---------------- releases/1.2/ Property changes on: releases/1.2 ___________________________________________________________________ Added: svn:mergeinfo + /trunk/1.2:911 Modified: releases/1.2/templates/content/project/view/index.content.tmpl =================================================================== --- releases/1.2/templates/content/project/view/index.content.tmpl 2008-08-28 04:23:06 UTC (rev 911) +++ releases/1.2/templates/content/project/view/index.content.tmpl 2008-08-28 04:24:51 UTC (rev 912) @@ -30,7 +30,7 @@ </div> </td> <td rowspan="5" align="center"><b>Participants:</b><BR> - <select name='data[linked_users][]' multiple size='10'> + <select name='data[linked_users][]' multiple size='10' style="background-color:#e9e9e9"> {select_linked_users} </select> </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-28 04:23:08
|
Revision: 911 http://cs-project.svn.sourceforge.net/cs-project/?rev=911&view=rev Author: crazedsanity Date: 2008-08-28 04:23:06 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Make the "select multiple" box for project associated users stand out more. Modified Paths: -------------- trunk/1.2/templates/content/project/view/index.content.tmpl Modified: trunk/1.2/templates/content/project/view/index.content.tmpl =================================================================== --- trunk/1.2/templates/content/project/view/index.content.tmpl 2008-08-28 03:59:39 UTC (rev 910) +++ trunk/1.2/templates/content/project/view/index.content.tmpl 2008-08-28 04:23:06 UTC (rev 911) @@ -30,7 +30,7 @@ </div> </td> <td rowspan="5" align="center"><b>Participants:</b><BR> - <select name='data[linked_users][]' multiple size='10'> + <select name='data[linked_users][]' multiple size='10' style="background-color:#e9e9e9"> {select_linked_users} </select> </td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-28 03:59:43
|
Revision: 910 http://cs-project.svn.sourceforge.net/cs-project/?rev=910&view=rev Author: crazedsanity Date: 2008-08-28 03:59:39 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Remove svn:externals definition for the release (so they can be exported/imported). Added Paths: ----------- releases/1.2/lib/cs-arrayToPath/ releases/1.2/lib/cs-arrayToPath/LICENSE releases/1.2/lib/cs-arrayToPath/VERSION releases/1.2/lib/cs-arrayToPath/arrayToPathClass.php releases/1.2/lib/cs-arrayToPath/cs_versionAbstract.class.php releases/1.2/lib/cs-content/ releases/1.2/lib/cs-content/LICENSE releases/1.2/lib/cs-content/README.txt releases/1.2/lib/cs-content/VERSION releases/1.2/lib/cs-content/contentSystemClass.php releases/1.2/lib/cs-content/cs_bbCodeParser.class.php releases/1.2/lib/cs-content/cs_fileSystemClass.php releases/1.2/lib/cs-content/cs_genericPageClass.php releases/1.2/lib/cs-content/cs_globalFunctions.php releases/1.2/lib/cs-content/cs_phpDB.php releases/1.2/lib/cs-content/cs_sessionClass.php releases/1.2/lib/cs-content/cs_tabsClass.php releases/1.2/lib/cs-content/cs_versionAbstract.class.php releases/1.2/lib/cs-content/db_types/ releases/1.2/lib/cs-content/db_types/cs_phpDB__mysql.class.php releases/1.2/lib/cs-content/db_types/cs_phpDB__pgsql.class.php releases/1.2/lib/cs-content/db_types/cs_phpDB__sqlite.class.php releases/1.2/lib/cs-content/sample_files/ releases/1.2/lib/cs-content/sample_files/public_html/ releases/1.2/lib/cs-content/sample_files/public_html/.htaccess releases/1.2/lib/cs-content/sample_files/public_html/content releases/1.2/lib/cs-content/sample_files/public_html/index.php releases/1.2/lib/cs-content/sample_files/templates/ releases/1.2/lib/cs-content/sample_files/templates/content/ releases/1.2/lib/cs-content/sample_files/templates/content/index.content.tmpl releases/1.2/lib/cs-content/sample_files/templates/footer.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/header.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/infobar.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/main.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/menu.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/ releases/1.2/lib/cs-content/sample_files/templates/system/404.shared.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/construction.content.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/db_error.tmpl releases/1.2/lib/cs-content/sample_files/templates/system/message_box.tmpl releases/1.2/lib/cs-content/template.inc releases/1.2/lib/cs-phpxml/ releases/1.2/lib/cs-phpxml/LICENSE releases/1.2/lib/cs-phpxml/README.txt releases/1.2/lib/cs-phpxml/VERSION releases/1.2/lib/cs-phpxml/xmlAbstract.class.php releases/1.2/lib/cs-phpxml/xmlBuilderClass.php releases/1.2/lib/cs-phpxml/xmlCreatorClass.php releases/1.2/lib/cs-phpxml/xmlParserClass.php Property Changed: ---------------- releases/1.2/lib/ Property changes on: releases/1.2/lib ___________________________________________________________________ Deleted: svn:externals - cs-content https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/0.10 cs-phpxml https://cs-phpxml.svn.sourceforge.net/svnroot/cs-phpxml/trunk cs-arrayToPath https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk Added: releases/1.2/lib/cs-arrayToPath/LICENSE =================================================================== --- releases/1.2/lib/cs-arrayToPath/LICENSE (rev 0) +++ releases/1.2/lib/cs-arrayToPath/LICENSE 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,291 @@ +NOTE: a full HTML version of this license can be found at: +http://www.opensource.org/licenses/gpl-license.php + +It has been reproduced below without any HTML. +========================================================================== + +The GNU General Public License (GPL) + +Version 2, June 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: releases/1.2/lib/cs-arrayToPath/VERSION =================================================================== --- releases/1.2/lib/cs-arrayToPath/VERSION (rev 0) +++ releases/1.2/lib/cs-arrayToPath/VERSION 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,5 @@ +## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file. + +VERSION: 0.2.2 +PROJECT: cs-arrayToPath +$HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/VERSION $ \ No newline at end of file Added: releases/1.2/lib/cs-arrayToPath/arrayToPathClass.php =================================================================== --- releases/1.2/lib/cs-arrayToPath/arrayToPathClass.php (rev 0) +++ releases/1.2/lib/cs-arrayToPath/arrayToPathClass.php 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,379 @@ +<?php +/* + * Created on Nov 20, 2006 + * + * SVN INFORMATION::: + * ------------------- + * Last Author::::::::: $Author: crazedsanity $ + * Current Revision:::: $Revision: 17 $ + * Repository Location: $HeadURL: https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk/arrayToPathClass.php $ + * Last Updated:::::::: $Date: 2007-09-12 14:24:46 -0500 (Wed, 12 Sep 2007) $ + * + * + * Basically traverses an array as though it were a filesystem. In the given example, it looks + * more complex than necessary, but the "NEW WAY" is very programatic, whereas the "OLD WAY" is + * just that: OLD. Also, the new way is very extensible, and is handy when performing a LOT of + * complex operations on an array. + * Example: + * OLD WAY: + * $my_data = $array['path']['to']['your']['hidden']['data']; + * $my_vault = $array['path']['to']['your']['hidden']['vault']; + * $my_other = $array['path']['to']['your']['hidden']['other']; + * + * $array['path']['to']['my'] = array(); + * $array['path']['to']['my']['data'] = array(); + * $array['path']['to']['my']['data']['is'] = "here"; + * NEW WAY: + * $arrayToPath = new arrayToPath($array); + * $my_data = $arrayToPath('/path/to/your/hidden/data'); + * $my_vault = $arrayToPath('/path/to/your/hidden/vault'); + * $my_other = $arrayToPath('/path/to/your/hidden/other'); + * + * $arrayToPath->set_data('/path/to/my/data/is', 'here'); + */ + + +require_once(dirname(__FILE__) .'/cs_versionAbstract.class.php'); + +class arrayToPath extends cs_a2p_versionAbstract { + + private $prefix = NULL; //the first directory to use. + private $data; + private $iteration = 0; + + //====================================================================================== + /** + * The constructor. + * + * @param $array (array) The data that will be used when + * + * TODO::: there is a strange recursion issue when $prefix is non-null: prefix is presently hardwired as NULL for now... + */ + public function __construct($array, $prefix=NULL) { + if($array === 'unit_test') { + //it's a unit test. + $this->isTest = TRUE; + } + else { + $this->get_version(); + $prefix=NULL; + if(!is_array($array)) { + //I don't deal with non-arrays. Idiot. + exit('arrayToPath{}->__construct(): got an invalid datatype.'); + } + //create a reference to the data, so if it changes, the class doesn't have to be re-initialized. + $this->data = $array; + + //now set the prefix ONLY if the prefix is valid. + if(!is_null($prefix) && strlen($prefix)) { + //got a good prefix, so use it. + $this->prefix = $prefix; + } + } + }//end __construct() + //====================================================================================== + + + //====================================================================================== + /** + * Takes a path & returns the appropriate index in the session. + * + * @param $path <str> path to the appropriate section in the session. + * + * @return <NULL> FAIL: unable to find requested index. + * @return <mixed> PASS: this is the value of the index. + */ + public function get_data($path=NULL) { + $myIndexList = array(); + $path = $this->fix_path($path); + + if(is_null($path) || (strlen($path) < 1)) { + //they just want ALL THE DATA. + $retval = $this->data; + } + else { + //get the list of indices in our data that we have to traverse. + $myIndexList = $this->explode_path($path); + + //set an initial retval. + $retval = $this->get_data_segment($this->data, $myIndexList[0]); + unset($myIndexList[0]); + + if(count($myIndexList) > 0) { + foreach($myIndexList as $indexName) { + $retval = $this->get_data_segment($retval, $indexName); + if(is_null($retval)) { + //hmm... well, if it's null, it's nothing which can have a sub-index. Stop here. + break; + } + } + } + } + + return($retval); + + }//end get_data() + //====================================================================================== + + + + //====================================================================================== + /** + * Returns a given index from a piece of data, used by get_data(). + */ + private function get_data_segment($fromThis, $indexName) { + if(is_array($fromThis)) { + //it's an array. + $retval = $fromThis[$indexName]; + } + elseif(is_object($fromThis)) { + //it's an object. + $retval = $fromThis->$indexName; + } + return($retval); + }//end get_data_segment() + //====================================================================================== + + + + //====================================================================================== + /** + * Pre-pends the internal $this->prefix onto the given path. + * + * @param $path <str> path to append $this->prefix onto. + * + * @return <str> PASS: this is the path with our prefix added. + */ + private function fix_path($path) { + if(is_null($path) && is_null($this->prefix)) { + //all data is null. don't bother changing it. + $retval = NULL; + } + else { + //remove slashes at the beginning or end of the path. + $path = preg_replace('/\/$/', '', $path); + + if(preg_match('/\/$/', $this->prefix)) { + //remove the trailing slash. + $this->prefix = preg_replace('/$\//', '', $this->prefix); + } + if(preg_match('/^\//', $this->prefix)) { + $this->prefix = preg_replace('/^\//', '', $this->prefix); + } + $path = preg_replace('/\/$/', '', $path); + + //should we add our prefix? + if(preg_match('/^\//', $path)) { + $retval = $path; + } + else { + $retval = $this->prefix ."/". $path; + } + + //remove a trailing slash, if present, before returning. + $retval = preg_replace('/\/$/', '', $retval); + } + + return($retval); + + }//end fix_path() + //====================================================================================== + + + + //====================================================================================== + /** + * Sets data into the given path, with options to override our internal prefix, and to + * force-overwrite data if it's not an array. + * + * @param $path <str> path to set the data into. + * @param $data <mixed> what to set into the given path. + * + * @return 0 FAIL: old data doesn't match new data. + * @return 1 PASS: everything lines-up. + */ + public function set_data($path, $data) { + //get the list of indices in the session that we have to traverse. + $myIndexList = $this->explode_path($path); + + $retval = 0; + //Use an internal iterator to go through the little bits of the session & set the + // data where it's supposed to be. + if($path === '/' || count($myIndexList) == 0) { + //setting the data. + $this->data = $data; + $retval = 1; + } + elseif(count($myIndexList) == 1) { + //that should be simple: set the index to be $data. + $this->data[$myIndexList[0]] = $data; + $retval = 1; + } + elseif(count($myIndexList) > 1) { + $this->internal_iterator($this->data, $path, $data); + $retval = 1; + } + + return($retval); + }//end set_data() + //====================================================================================== + + + //====================================================================================== + /** + * Iterates through the session to create the values for set_data(). This method passes + * AND returns the $array argument by reference. + * + * @param &$array (array) iterate through this. + * @param $path (array) numbered array of keys, representing a path through the + * internal data to go through to set $data. + * @param $data (mixed) data to set into the path referenced in $indexList. + * + * @return <void> + */ + protected function &internal_iterator(&$array, $path, $data) { + //make sure it doesn't call itself to death. ;) + $this->iteration++; + + if($this->iteration > 1000) { + throw new exception("arrayToPath{}: too many iterations, path=($path)"); + } + + $retval = 0; + $indexList = $this->explode_path($path); + $myIndex = array_shift($indexList); + $path = $this->string_from_array($indexList); + + if(is_array($array) && !strlen($path)) { + if(isset($myIndex)) { + //set the final piece of the array. + $array[$myIndex] = $data; + } + else { + //something is broken. + throw new exception("arrayToPath{}->internal_iterator(): no index ($myIndex) to follow at the end of the path."); + } + } + elseif(is_array($array) && strlen($path)) { + if((count($indexList) == 0) || (is_array($indexList) && count($indexList) > 1)) { + if(!is_array($array[$myIndex])) { + $array[$myIndex] = array(); + } + $array = &$array[$myIndex]; + $newPath = $this->string_from_array($indexList); + + $this->internal_iterator($array, $path, $data); + } + elseif(is_array($indexList) && count($indexList) == 1) { + if(!is_array($array[$myIndex])) { + $array[$myIndex] = array(); + } + $array = &$array[$myIndex]; + $this->internal_iterator($array, $indexList[0], $data); + } + else { + //not sure what to do but throw an exception. + throw new exception("arrayToPath{}->internal_iterator(): unknown error ('not sure what to do'): ($array)"); + } + } + elseif(is_object($array)) { + //can't handle objects...? + throw new exception("arrayToPath{}->internal_iterator(): can't handle objects...?"); + } + else { + //something is... er... broken. + throw new exception("arrayToPath{}->internal_iterator(): found unknown data type in path ($array)"); + } + + //decrement the iteration, so methods using it can call it multiple times without worrying about accidentally hitting the limit. + $this->iteration--; + }//end internal_iterator() + //====================================================================================== + + + + + //====================================================================================== + /** + * Will unset the final index in the $path var. I.E. to unset $this->array['x']['y'], + * call unset_data('/x/y') + * + * @param $path (str) path to unset data; The last item in the path will be removed. + */ + public function unset_data($path) { + //explode the path. + $pathArr = $this->explode_path($path); + $removeThis = array_pop($pathArr); + $path = $this->string_from_array($pathArr); + + //retrieve the data... + $myData = $this->get_data($path); + + if(is_array($myData)) { + //now remove the bit of data as requested. + unset($myData[$removeThis]); + //update the path with our new data. + $retval = $this->set_data($path, $myData); + } + else { + //throw a terrible error. + throw new exception("unset_data(): data ($myData) wasn't an array! ($path)"); + } + + return($retval); + }//end unset_data() + //====================================================================================== + + + + //====================================================================================== + /** + * Performs all the work of exploding the path and fixing it. + * + * @param $path <string> Path to work with. + * @return <array> PASS: array contains exploded path. + */ + public function explode_path($path) { + $path = preg_replace('/\/\//', '/', $path); + $path = $this->fix_path($path); + $retval = explode('/', $path); + + //if the initial index is blank, just remove it. + if($retval[0] == '' || strlen($retval[0]) < 1) { + //it was blank! KILL IT! + $checkItOut = array_shift($retval); + } + + return($retval); + }//end explode_path() + //====================================================================================== + + + + //====================================================================================== + public function reload_data($array) { + //call the constructor on it, and pass along the CURRENT prefix, so it doesn't get reset. + $this->__construct($array, $this->prefix); + }//end reload_data() + //====================================================================================== + + + + //====================================================================================== + private function string_from_array(array $array) { + $retval = ""; + foreach($array as $index) { + if(strlen($retval)) { + $retval .= "/". $index; + } + else { + $retval = $index; + } + } + return($retval); + }//end string_from_array() + //====================================================================================== + +}//end arrayToPath{} + +?> Added: releases/1.2/lib/cs-arrayToPath/cs_versionAbstract.class.php =================================================================== --- releases/1.2/lib/cs-arrayToPath/cs_versionAbstract.class.php (rev 0) +++ releases/1.2/lib/cs-arrayToPath/cs_versionAbstract.class.php 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,86 @@ +<?php +/* + * Created on Sept. 12, 2007 + * + * SVN INFORMATION::: + * ------------------- + * Last Author::::::::: $Author: crazedsanity $ + * Current Revision:::: $Revision: 153 $ + * Repository Location: $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/cs_versionAbstract.class.php $ + * Last Updated:::::::: $Date: 2007-09-12 13:33:15 -0500 (Wed, 12 Sep 2007) $ + */ + +abstract class cs_a2p_versionAbstract { + + public $isTest=FALSE; + + abstract public function __construct(); + + + + //========================================================================= + /** + * Retrieve our version string from the VERSION file. + */ + final public function get_version() { + $retval = NULL; + $versionFileLocation = dirname(__FILE__) .'/VERSION'; + if(file_exists($versionFileLocation)) { + $myData = file($versionFileLocation); + + //set the logical line number that the version string is on, and + // drop by one to get the corresponding array index. + $lineOfVersion = 3; + $arrayIndex = $lineOfVersion -1; + + $myVersionString = trim($myData[$arrayIndex]); + + if(preg_match('/^VERSION: /', $myVersionString)) { + $retval = preg_replace('/^VERSION: /', '', $myVersionString); + } + else { + throw new exception(__METHOD__ .": failed to retrieve version string"); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve version information"); + } + + return($retval); + }//end get_version() + //========================================================================= + + + + //========================================================================= + final public function get_project() { + $retval = NULL; + $versionFileLocation = dirname(__FILE__) .'/VERSION'; + if(file_exists($versionFileLocation)) { + $myData = file($versionFileLocation); + + //set the logical line number that the version string is on, and + // drop by one to get the corresponding array index. + $lineOfProject = 4; + $arrayIndex = $lineOfProject -1; + + $myProject = trim($myData[$arrayIndex]); + + if(preg_match('/^PROJECT: /', $myProject)) { + $retval = preg_replace('/^PROJECT: /', '', $myProject); + } + else { + throw new exception(__METHOD__ .": failed to retrieve project string"); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve project information"); + } + + return($retval); + }//end get_project() + //========================================================================= + + +} +?> \ No newline at end of file Property changes on: releases/1.2/lib/cs-arrayToPath/cs_versionAbstract.class.php ___________________________________________________________________ Added: svn:executable + * Added: releases/1.2/lib/cs-content/LICENSE =================================================================== --- releases/1.2/lib/cs-content/LICENSE (rev 0) +++ releases/1.2/lib/cs-content/LICENSE 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,291 @@ +NOTE: a full HTML version of this license can be found at: +http://www.opensource.org/licenses/gpl-license.php + +It has been reproduced below without any HTML. +========================================================================== + +The GNU General Public License (GPL) + +Version 2, June 1991 + + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: releases/1.2/lib/cs-content/README.txt =================================================================== --- releases/1.2/lib/cs-content/README.txt (rev 0) +++ releases/1.2/lib/cs-content/README.txt 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,5 @@ +Documentation is now located at: +[https://cs-content.svn.sourceforge.net/svnroot/cs-content/documentation]. It +has been moved to avoid unnecessarily large downloads. + +$Id: README.txt 267 2008-04-29 15:27:28Z crazedsanity $ \ No newline at end of file Added: releases/1.2/lib/cs-content/VERSION =================================================================== --- releases/1.2/lib/cs-content/VERSION (rev 0) +++ releases/1.2/lib/cs-content/VERSION 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,5 @@ +## Stores the current version of the cs-content system, and it's source. Please do NOT modify this file. + +VERSION: 0.10.12 +PROJECT: cs-content +$HeadURL:https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/VERSION $ \ No newline at end of file Added: releases/1.2/lib/cs-content/contentSystemClass.php =================================================================== --- releases/1.2/lib/cs-content/contentSystemClass.php (rev 0) +++ releases/1.2/lib/cs-content/contentSystemClass.php 2008-08-28 03:59:39 UTC (rev 910) @@ -0,0 +1,858 @@ +<?php +/* + * FILE INFORMATION: + * $HeadURL: https://cs-content.svn.sourceforge.net/svnroot/cs-content/trunk/0.10/contentSystemClass.php $ + * $Id: contentSystemClass.php 288 2008-06-04 18:20:26Z crazedsanity $ + * $LastChangedDate: 2008-06-04 13:20:26 -0500 (Wed, 04 Jun 2008) $ + * $LastChangedRevision: 288 $ + * $LastChangedBy: crazedsanity $ + * + * HOW THE SYSTEM WORKS::: + * TEMPLATE FILES: + * Automatically loads templates based on the URL, and optionally includes scripts in the includes directory. + * + * MAIN SECTION: + * For the main section, i.e. "/content", it requires a template in a directory of that name beneath + * /templates, with a file called "index.content.tmpl"... i.e. /templatee/content/index.content.tmpl. + * SUB SECTIONS: + * For any subsection to be valid, i.e. "/content/members", it must have an associated template, i.e. + * "/templates/content/members.content.tmpl". If a subdirectory with an index.content.tmpl file exists, it will + * be used instead of the file in the sub directory (i.e. "/templates/content/members/index.content.tmpl"). + * SUB SECTION TEMPLATE INHERITANCE: + * All pages load the base set of "shared" templates, which are in the form "<section>.shared.tmpl" in + * the root of the templates directory. + * + * Shared files within each directory, in the form "<section>.shared.tmpl", will be loaded for ANY subsection. + * + * For any subsection, it inherits a previous section's templates in the following manner (any "content" + * templates are ignored for inheritance, as they're require for page load). + * /content ---> /templates/content/index.*.tmpl + * + * /content/members |--> /templates/content/index.*.tmpl + * `--> /templates/content/members.*.tmpl + * + * /content/members/test |--> /templates/content/index.*.tmpl + * |--> /templates/content/members.*.tmpl + * |--> /templates/content/members/index.*.tmpl + * `--> /templates/content/members/test.*.tmpl + * AUTOMATIC INCLUDES: + * Much in the same way templates are included, so are scripts, from the /includes directory, though the logic + * is decidedly simpler: all scripts must have the extension of ".inc", and must have either the section's name + * as the first part of the filename, or "shared". Shared scripts will be loaded for ALL subsections. + * + * INCLUDES INHERITANCE: + * The template inheritance scheme is as laid-out below. The content system will go as far into the + * includes directory as it can for the given section, regardless of if any intermediate files are missing. + * + * It is important to note that the content system will NOT regard a section as valid if there are include + * scripts but no templates. + * + * /content |--> /includes/shared.inc + * `--> /includes/content.inc + * + * /content/members |--> /includes/shared.inc + * |--> /includes/content.inc + * |--> /includes/content/shared.inc + * `--> /includes/content/members.inc + * + * /content/members/test |--> /includes/shared.inc + * |--> /includes/content.inc + * |--> /includes/content/shared.inc + * |--> /includes/content/members.inc + * |--> /includes/content/members/shared.inc + * |--> /includes/content/members/test.inc + */ + +//TODO: remove this terrible little hack. +if(!isset($GLOBALS['SITE_ROOT'])) { + //define where our scripts are located. + $GLOBALS['SITE_ROOT'] = $_SERVER['DOCUMENT_ROOT']; + $GLOBALS['SITE_ROOT'] = str_replace("/public_html", "", $GLOBALS['SITE_ROOT']); +} + +require_once(dirname(__FILE__) ."/cs_globalFunctions.php"); +require_once(dirname(__FILE__) ."/cs_fileSystemClass.php"); +require_once(dirname(__FILE__) ."/cs_sessionClass.php"); +require_once(dirname(__FILE__) ."/cs_genericPageClass.php"); +require_once(dirname(__FILE__) ."/cs_tabsClass.php"); +require_once(dirname(__FILE__) ."/cs_versionAbstract.class.php"); + +class contentSystem extends cs_versionAbstract { + + protected $baseDir = NULL; //base directory for templates & includes. + protected $section = NULL; //section string, derived from the URL. + protected $sectionArr = array(); //array of items, for figuring out where templates & includes are. + protected $fileSystemObj = NULL; //the object used to access the filesystem. + protected $ignoredList = array( //array of files & folders that are implicitely ignored. + 'file' => array('.htaccess'), + 'dir' => array('.svn','CVS' + ) + ); + protected $templateList = array(); + protected $includesList = array(); + public $templateObj = NULL; + protected $gfObj = NULL; + protected $tabs = NULL; + + protected $finalSection; + + private $isValid=FALSE; + private $reason=NULL; + + //------------------------------------------------------------------------ + /** + * The CONSTRUCTOR. Duh. + */ + public function __construct($testOnly=FALSE) { + if($testOnly === 'unit_test') { + //It's just a test, don't do anything we might regret later. + $this->isTest = TRUE; + } + else { + $this->get_version(); + $this->get_project(); + //make a cs_globalFunctions{} object. + $this->gfObj = new cs_globalFunctions(); + + //setup the section stuff... + $repArr = array($_SERVER['SCRIPT_NAME'], "/"); + $_SERVER['REQUEST_URI'] = ereg_replace('^/', "", $_SERVER['REQUEST_URI']); + + //figure out the section & subsection stuff. + $this->section = $this->clean_url($_SERVER['REQUEST_URI']); + + $this->initialize_locals(); + } + }//end __construct() + //------------------------------------------------------------------------ + + + + //------------------------------------------------------------------------ + /** + * Creates internal objects & prepares for later usage. + */ + private function initialize_locals() { + //build the templating engine: this may cause an immediate redirect, if they need to be logged-in. + //TODO: find a way to define this on a per-page basis. Possibly have templateObj->check_login() + // run during the "finish" stage... probably using GenericPage{}->check_login(). + $this->templateObj = new cs_genericPage(FALSE, "main.shared.tmpl"); + + //setup some default template vars. + $this->templateObj->add_template_var('date', date('m-d-Y')); + $this->templateObj->add_template_var('time', date('H:i:s')); + + $myUrl = '/'; + if(strlen($this->section) && $this->section !== 0) { + $myUrl = '/'. $this->section; + } + $this->templateObj->add_template_var('CURRENT_URL', $myUrl); + + //create a fileSystem object. + $this->fileSystemObj = new cs_fileSystemClass(); + + //create a tabs object, in case they want to load tabs on the page. + $this->tabs = new cs_tabs($this->templateObj); + + //check versions, make sure they're all the same. + $myVersion = $this->get_version(); + if($this->templateObj->get_version() !== $myVersion) { + throw new exception(__METHOD__ .": ". get_class($this->templateObj) ." has mismatched version (". $this->templateObj->get_version() ." does not equal ". $myVersion .")"); + } + if($this->fileSystemObj->get_version() !== $myVersion) { + throw new exception(__METHOD__ .": ". get_cl... [truncated message content] |
From: <cra...@us...> - 2008-08-28 02:58:21
|
Revision: 909 http://cs-project.svn.sourceforge.net/cs-project/?rev=909&view=rev Author: crazedsanity Date: 2008-08-28 02:58:18 +0000 (Thu, 28 Aug 2008) Log Message: ----------- *** RELEASE 1.2.0-ALPHA8 *** SUMMARY OF CHANGES: * update to cs-content v0.10.12 * fix problem in setup with cs_globalFunctions::string_from_array() when cleanString agument sent. * remove record type and log category stuff from setup (step 3). * remove bogus svn property on prefClass * display username on contact details where applicable * add users associated with parent project to notify list for new issues. NOTICE: This is intended as an SVN-only release. While it may be a stable version, any updates may cause sudden instabilities, and the codebase has not been properly tested. Added Paths: ----------- releases/1.2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-28 02:52:30
|
Revision: 908 http://cs-project.svn.sourceforge.net/cs-project/?rev=908&view=rev Author: crazedsanity Date: 2008-08-28 02:52:28 +0000 (Thu, 28 Aug 2008) Log Message: ----------- *** RELEASE 1.2.0-ALPHA8 *** SUMMARY OF CHANGES: * update to cs-content v0.10.12 * fix problem in setup with cs_globalFunctions::string_from_array() when cleanString agument sent. * remove record type and log category stuff from setup (step 3). * remove bogus svn property on prefClass * display username on contact details where applicable * add users associated with parent project to notify list for new issues. Modified Paths: -------------- trunk/1.2/VERSION Modified: trunk/1.2/VERSION =================================================================== --- trunk/1.2/VERSION 2008-08-26 03:30:56 UTC (rev 907) +++ trunk/1.2/VERSION 2008-08-28 02:52:28 UTC (rev 908) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.2.0-ALPHA7 +VERSION: 1.2.0-ALPHA8 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-26 03:30:59
|
Revision: 907 http://cs-project.svn.sourceforge.net/cs-project/?rev=907&view=rev Author: crazedsanity Date: 2008-08-26 03:30:56 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Add users associated with parent project to notify list when creating issues. Modified Paths: -------------- trunk/1.2/lib/helpdeskClass.php Modified: trunk/1.2/lib/helpdeskClass.php =================================================================== --- trunk/1.2/lib/helpdeskClass.php 2008-08-26 03:28:35 UTC (rev 906) +++ trunk/1.2/lib/helpdeskClass.php 2008-08-26 03:30:56 UTC (rev 907) @@ -347,6 +347,19 @@ $normalEmailExtra = NULL; $emailAddressList = $linkObj->get_record_email_list($newRecord); + ## If there's an associated project, get the records for that, too... + if(is_numeric($dataArr['parentRecordId'])) { + $list = $this->get_record_contact_associations($dataArr['parentRecordId']); + + if(is_array($list)) { + foreach($list as $myContactId=>$data) { + if(!isset($emailAddressList[$myContactId])) { + $emailAddressList[$myContactId] = $data['email']; + } + } + } + } + if((strlen($_SESSION['login_email'])) && ($_SESSION['login_email'] != $parseArr['email'])) { $subject = "Helpdesk Issue #$retval [for ".$parseArr['email'] ."] -- ". $parseArr['name']; send_email($emailAddressList, $subject, $emailTemplate, $parseArr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-26 03:28:38
|
Revision: 906 http://cs-project.svn.sourceforge.net/cs-project/?rev=906&view=rev Author: crazedsanity Date: 2008-08-26 03:28:35 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Display username on contact details (where applicable). /includes/content/contacts.inc: * when displaying contact information, display the username. /lib/userClass.php: * get_user_info(): -- updated to allow an array as criteria for fine-grained searching. -- NOTE: allowable fields should be limited to avoid database errors. /templates/content/contacts/view.contact.tmpl: * new block row in static display to show username. Modified Paths: -------------- trunk/1.2/includes/content/contacts.inc trunk/1.2/lib/userClass.php trunk/1.2/templates/content/contacts/view.content.tmpl Modified: trunk/1.2/includes/content/contacts.inc =================================================================== --- trunk/1.2/includes/content/contacts.inc 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/includes/content/contacts.inc 2008-08-26 03:28:35 UTC (rev 906) @@ -141,10 +141,19 @@ if(is_numeric($contactId)) { try{ + $page->rip_all_block_rows(); + + $contactObj->set_contact_id($contactId); $contactDetails = $contactObj->get_contact(); - $page->rip_all_block_rows(); + $userDetails = $user->get_user_info(array('contact_id'=>$contactId)); + if(is_array($userDetails)) { + $contactDetails['username'] = $userDetails['username']; + $page->add_template_var('display_username', $page->templateRows['display_username']); + } + + //set the main details. foreach($contactDetails as $name=>$value) { $page->add_template_var($name, $value); Modified: trunk/1.2/lib/userClass.php =================================================================== --- trunk/1.2/lib/userClass.php 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/lib/userClass.php 2008-08-26 03:28:35 UTC (rev 906) @@ -155,17 +155,20 @@ function get_user_info($findThis) { $retval = 0; - if(isset($findThis) && strlen($findThis)) { - $findThis = strtolower($findThis); + if(isset($findThis) && (strlen($findThis) || is_array($findThis))) { if(is_numeric($findThis)) { $criteria = "uid = $findThis"; } + elseif(is_array($findThis)) { + $criteria = $this->gfObj->string_from_array($findThis, 'select', NULL, 'sql'); + } else { + $findThis = strtolower($findThis); $criteria = "lower(username) = '$findThis'"; } - $query = "SELECT * from user_table WHERE $criteria"; + $query = "SELECT * from user_table WHERE ". $criteria; $numrows = $this->db->exec($query); $dberror = $this->db->errorMsg(); Modified: trunk/1.2/templates/content/contacts/view.content.tmpl =================================================================== --- trunk/1.2/templates/content/contacts/view.content.tmpl 2008-08-26 00:43:08 UTC (rev 905) +++ trunk/1.2/templates/content/contacts/view.content.tmpl 2008-08-26 03:28:35 UTC (rev 906) @@ -1,4 +1,3 @@ - <form method="POST" onSubmit="new Effect.DropOut(submitButton);" name="updateContactForm"> <input type="HIDDEN" name="contact_id" value="{contact_id}"> <div id="mainContact_static" style="display:inline;"> @@ -7,6 +6,9 @@ <td style="border:solid #000 1px; "> <h1 style="display:inline">{company}</h1><BR> <center><div style="display:inline;text-align:center;">{fname} {lname} (<i>{email}</i>)</div></center> + <!-- BEGIN display_username --> + <center><div style="display:inline;text-align:center;">Username: {username}</div></center> + <!-- END display_username --> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-08-26 00:43:13
|
Revision: 905 http://cs-project.svn.sourceforge.net/cs-project/?rev=905&view=rev Author: crazedsanity Date: 2008-08-26 00:43:08 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Removed unneeded notifier class... NOTE: after thinking about it, a special object for notifying just doesn't make sense based on the current setup. Removed Paths: ------------- trunk/1.2/lib/notifier.class.php Deleted: trunk/1.2/lib/notifier.class.php =================================================================== --- trunk/1.2/lib/notifier.class.php 2008-07-22 02:04:24 UTC (rev 904) +++ trunk/1.2/lib/notifier.class.php 2008-08-26 00:43:08 UTC (rev 905) @@ -1,58 +0,0 @@ -<?php - -/* - * Created on Jul 21, 2008 - * - * SVN INFORMATION::: - * ------------------ - * SVN Signature::::::: $Id$ - * Last Author::::::::: $Author$ - * Current Revision:::: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated:::::::: $Date$ - */ - - -class notifier { - - private $obj=NULL; - private $userList=array(); - private $userListMethod=NULL; - private $recordId=NULL; - - //========================================================================= - public function __construct($obj, $recordId, $userListMethod=NULL) { - if(!is_numeric($recordId) || $recordId < 1) { - throw new exception(__METHOD__ .": invalid record id (". $recordId .")"); - } - if(!strlen($userListMethod)) { - $userListMethod = 'get_user_list'; - } - $this->userListMethod = $userListMethod; - if(is_object($obj)) { - if(!method_exists($obj, $this->userListMethod)) { - throw new exception(__METHOD__ .": method to pull list of users (". $this->userListMethod .") missing"); - } - $this->obj = $obj; - } - else { - throw new exception(__METHOD__ .": invalid data for object (". $obj .")"); - } - }//end __construct() - //========================================================================= - - - //========================================================================= - public function send_notice($subject, $bodyTemplate, array $parseArr=NULL) { - $userListMethod = $this->userListMethod; - $userList = $this->obj->$userListMethod($this->recordId); - - $retval = send_email($userList, $subject, $bodyTemplate, $parseArr); - - return($retval); - }//end send_notice() - //========================================================================= - -}//end notifier{} - -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-07-22 02:04:26
|
Revision: 904 http://cs-project.svn.sourceforge.net/cs-project/?rev=904&view=rev Author: crazedsanity Date: 2008-07-22 02:04:24 +0000 (Tue, 22 Jul 2008) Log Message: ----------- New notifier class (unimplemented) to send emails... Added Paths: ----------- trunk/1.2/lib/notifier.class.php Added: trunk/1.2/lib/notifier.class.php =================================================================== --- trunk/1.2/lib/notifier.class.php (rev 0) +++ trunk/1.2/lib/notifier.class.php 2008-07-22 02:04:24 UTC (rev 904) @@ -0,0 +1,58 @@ +<?php + +/* + * Created on Jul 21, 2008 + * + * SVN INFORMATION::: + * ------------------ + * SVN Signature::::::: $Id$ + * Last Author::::::::: $Author$ + * Current Revision:::: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated:::::::: $Date$ + */ + + +class notifier { + + private $obj=NULL; + private $userList=array(); + private $userListMethod=NULL; + private $recordId=NULL; + + //========================================================================= + public function __construct($obj, $recordId, $userListMethod=NULL) { + if(!is_numeric($recordId) || $recordId < 1) { + throw new exception(__METHOD__ .": invalid record id (". $recordId .")"); + } + if(!strlen($userListMethod)) { + $userListMethod = 'get_user_list'; + } + $this->userListMethod = $userListMethod; + if(is_object($obj)) { + if(!method_exists($obj, $this->userListMethod)) { + throw new exception(__METHOD__ .": method to pull list of users (". $this->userListMethod .") missing"); + } + $this->obj = $obj; + } + else { + throw new exception(__METHOD__ .": invalid data for object (". $obj .")"); + } + }//end __construct() + //========================================================================= + + + //========================================================================= + public function send_notice($subject, $bodyTemplate, array $parseArr=NULL) { + $userListMethod = $this->userListMethod; + $userList = $this->obj->$userListMethod($this->recordId); + + $retval = send_email($userList, $subject, $bodyTemplate, $parseArr); + + return($retval); + }//end send_notice() + //========================================================================= + +}//end notifier{} + +?> Property changes on: trunk/1.2/lib/notifier.class.php ___________________________________________________________________ Added: svn:keywords + Id HeadURL Date Revision Author Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-07-22 02:04:01
|
Revision: 903 http://cs-project.svn.sourceforge.net/cs-project/?rev=903&view=rev Author: crazedsanity Date: 2008-07-22 02:03:57 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Remove bogus "svn:eol" property. Property Changed: ---------------- trunk/1.2/lib/prefClass.php Property changes on: trunk/1.2/lib/prefClass.php ___________________________________________________________________ Deleted: svn:eol - native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-07-22 01:16:06
|
Revision: 902 http://cs-project.svn.sourceforge.net/cs-project/?rev=902&view=rev Author: crazedsanity Date: 2008-07-22 01:16:04 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Remove record type and log category stuff. /includes/setup/3.inc: * go(): -- remove call to create_record_type_data() * create_log_categories_and_classes(): -- don't add "logcat__" stuff to the internal data array (which is eventually written to the config file. * create_record_type_data() [DELETED]: -- unneeded method removed. Modified Paths: -------------- trunk/1.2/includes/setup/3.inc Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-07-21 03:48:49 UTC (rev 901) +++ trunk/1.2/includes/setup/3.inc 2008-07-22 01:16:04 UTC (rev 902) @@ -155,7 +155,6 @@ //now that we've connected, start doing stuff. $retval = $this->set_version(); $retval .= "<BR>\n". $this->create_log_categories_and_classes(); - $retval .= "<BR>\n". $this->create_record_type_data(); $retval .= "<BR>\n". $this->create_attributes(); $retval .= "<BR>\n". $this->create_anonymous_contact_data(); $retval .= "<BR>\n". $this->create_status_records(); @@ -369,7 +368,6 @@ //good. $counter++; $this->totalRecords++; - $this->data['logcat__'. strtolower($name)] = $num; } else { throw new exception(__METHOD__ .": failed to create category record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); @@ -471,66 +469,6 @@ //========================================================================= - private function create_record_type_data() { - //format: - // {record_type_id} => array({name}, {module}) - $recordTypes = array( - 1 => array('Project', 'project'), - 2 => array('Task', 'task'), - 3 => array('Helpdesk', 'helpdesk') - ); - - $retval = 0; - foreach($recordTypes as $recTypeId => $subData) { - $insertArr = array( - 'record_type_id' => $recTypeId, - 'name' => $subData[0], - 'module' => $subData[1] - ); - $sql = "INSERT INTO record_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $this->totalRecords++; - $retval++; - $this->data['rectype__'. $insertArr['module']] = $recTypeId; - } - else { - throw new exception(__METHOD__ .": failed to create record for ". $insertArr['name'] - .", dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if(count($recordTypes) == $retval) { - - $sql = "SELECT setval('record_type_table_record_type_id_seq'::text, (SELECT max(record_type_id) FROM record_type_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - if($retval == count($recordTypes)) { - $retval = "Created all record types (". $retval .")"; - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error"); - } - - return($retval); - }//end create_record_type_data() - //========================================================================= - - - - //========================================================================= private function create_attributes() { $attributes = array( 3 => array('phone', 'phone', 'Phone'), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-07-21 03:48:55
|
Revision: 901 http://cs-project.svn.sourceforge.net/cs-project/?rev=901&view=rev Author: crazedsanity Date: 2008-07-21 03:48:49 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Fix a weird insert problem with cs_globalFunctions::string_from_array() when a cleanString argument is sent... Modified Paths: -------------- trunk/1.2/includes/setup/3.inc Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-07-21 03:20:21 UTC (rev 900) +++ trunk/1.2/includes/setup/3.inc 2008-07-21 03:48:49 UTC (rev 901) @@ -822,7 +822,7 @@ 1 => array('startModule', 'helpdesk', 'Starting on Module', 'Defines which section will be loaded upon login if nothing was selected.'), 5 => array('sorting_helpdesk', 'public_id|DESC', 'Helpdesk Sorting', 'Define the type of sorting for the helpdesk page.'), 6 => array('sorting_project', 'priority|ASC', 'Project Sorting', 'Define the type of sorting for the helpdesk page.'), - 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\'s details page.'), + 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\\\'s details page.'), 8 => array('projectDetails_showCompletedIssues', '1', 'Project Details: Display completed issues', 'Should completed issues display in the details of a project?') ); @@ -836,7 +836,7 @@ 'description' => $subData[3] ); - $sql = "INSERT INTO pref_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $sql = "INSERT INTO pref_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql_insert'); $numrows = $this->db->exec($sql); $dberror = $this->db->errorMsg(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-07-21 03:20:30
|
Revision: 900 http://cs-project.svn.sourceforge.net/cs-project/?rev=900&view=rev Author: crazedsanity Date: 2008-07-21 03:20:21 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Drop consolidation attempts from last few commits. SVN COMMAND::: merge -r898:896 https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/1.2 Modified Paths: -------------- trunk/1.2/includes/setup/1.inc trunk/1.2/includes/setup/2.inc trunk/1.2/includes/setup/3.inc trunk/1.2/includes/setup/5.inc trunk/1.2/includes/setup.inc Removed Paths: ------------- trunk/1.2/lib/setup.class.php Modified: trunk/1.2/includes/setup/1.inc =================================================================== --- trunk/1.2/includes/setup/1.inc 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/includes/setup/1.inc 2008-07-21 03:20:21 UTC (rev 900) @@ -10,14 +10,14 @@ if($_POST) { reset_all_steps(FALSE); - $setupObj->store_setup_data(1, $_POST['fields']); - $dbTestRes = $setupObj->test_db_stuff(); + store_setup_data(1, $_POST['fields']); + $dbTestRes = test_db_stuff(); if($dbTestRes === TRUE) { - $setupObj->store_setup_data(1, 1, 'result'); - $setupObj->store_setup_data(1, 'Values stored successfully', 'text'); + store_setup_data(1, 1, 'result'); + store_setup_data(1, 'Values stored successfully', 'text'); //set the next step as accessible. - $setupObj->store_setup_data(2, 1, 'accessible'); + store_setup_data(2, 1, 'accessible'); //TODO: consider moving the database connectivity tests into this step (and alter the status message below accordingly). $page->set_message_wrapper(array( @@ -29,8 +29,8 @@ } else { //oops... - $setupObj->store_setup_data(1, 0, 'result'); - $setupObj->store_setup_data(1, $dbTestRes, 'text'); + store_setup_data(1, 0, 'result'); + store_setup_data(1, $dbTestRes, 'text'); $page->set_message_wrapper(array( 'title' => "Failure", @@ -52,7 +52,7 @@ )); } - $setupData = $setupObj->get_setup_data(1,'data'); + $setupData = get_setup_data(1,'data'); if(!is_array($setupData) || !count($setupData)) { //provide some defaults. $setupData = array( Modified: trunk/1.2/includes/setup/2.inc =================================================================== --- trunk/1.2/includes/setup/2.inc 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/includes/setup/2.inc 2008-07-21 03:20:21 UTC (rev 900) @@ -7,21 +7,22 @@ if($_POST) { //check that step 1 was successful. - $setupObj->reset_all_steps(FALSE, 2); - $stepOneData = $setupObj->get_setup_data(1, 'data'); - if($setupObj->get_setup_data(1, 'result')) { + reset_all_steps(FALSE, 2); + $stepOneData = get_setup_data(1, 'data'); + if(get_setup_data(1, 'result')) { //first, check to see if we can connect to the host's "template1" database. $db = new cs_phpDB; - $setupObj->store_setup_data(2, 0, 'result'); - $result = $setupObj->test_db_stuff($db); + store_setup_data(2, 0, 'result'); + $result = test_db_stuff($db); if($result === TRUE) { //Good to go: load the schema! - $obj = new setup($page, $db); - $finalResult = $obj->handle_step(2); + //now create a temporary local class that does the rest. + $obj = new __tmpSetupClass($db, $page); + $finalResult = $obj->go(); $page->set_message_wrapper( array( @@ -34,7 +35,7 @@ } else { //not so good. Go back to step 1, so they can make changes. - $params = $setupObj->get_setup_data(1, 'data'); + $params = get_setup_data(1, 'data'); $page->set_message_wrapper( array( 'title' => "Test Failed", @@ -55,4 +56,191 @@ + +class __tmpSetupClass { + + + private $db; + private $fs; + private $page; + private $url = "/setup/1"; + + //========================================================================= + public function __construct(cs_phpDB &$db, cs_genericPage &$page) { + $this->db = $db; + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../../docs/sql/setup'); + $this->gfObj = new cs_globalFunctions; + $this->page = $page; + + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Initializing...', 'text'); + }//end __construct() + //========================================================================= + + + //========================================================================= + public function go() { + $retval = "Nothing done... something went horribly wrong."; + if($this->create_database()) { + $retval = $this->handle_plpgsql(); + + if($retval === TRUE) { + $retval = $this->load_schema(); + if($retval === TRUE) { + $this->page->set_message_wrapper( + array( + 'title' => "Step Successful", + 'message' => "Finished step two with result:::<BR>\n". get_setup_data(2,'text'), + 'type' => "status" + ) + ); + $this->page->conditional_header('/setup/3', TRUE); + } + else { + $retval = "There was an error while testing PL/PGSQL functionality: ". $retval; + store_setup_data(2, $retval, 'text'); + } + } + } + else { + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Failed to create database', 'text'); + $setupData = get_setup_data(1, 'data'); + $retval = "Unable to create database... check that ". $setupData['host'] . + " does not already have a database named '". $setupData['dbname'] ."'. " . + "Also, make sure no other user is connected to template1."; + } + + return($retval); + }//end go() + //========================================================================= + + + + //========================================================================= + private function create_database() { + $params = get_db_params(); + + //okay, let's try to create the database. + $numrows = $this->db->exec("CREATE DATABASE ". $params['dbname'] ." WITH ENCODING='SQL_ASCII'"); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $retval = FALSE; + } + else { + $retval = TRUE; + + //okay. Now destroy our database handle & create a new one, connected to the proper database. + unset($this->db); + $this->db = new cs_phpDb; + $this->db->connect(get_db_params()); + } + + return($retval); + }//end create_database() + //========================================================================= + + + //========================================================================= + private function load_schema() { + + store_setup_data(2, "Schema not loaded... ", 'text'); + store_setup_data(2, 0, 'result'); + + $fileData = $this->fsObj->read("01__storedprocs.sql"); + + //now we'll try to push that into the database. + $this->db->beginTrans(); + + $this->gfObj->debug_print("Loading stored procedures... "); + + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + //keep going + $retval = "Successfully loaded stored procedures! Loading tables...."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("02__tables.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "Done loading tables!!! Creating indexes and miscellaneous other things..."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("03__indexes_etc.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "All stored procedures, tables, and indexes have been created!"; + $this->gfObj->debug_print($retval); + + $this->db->commitTrans(); + store_setup_data(2, array(), 'data'); + store_setup_data(2, 1, 'result'); + store_setup_data(2, $retval, 'text'); + store_setup_data(3, 1, 'accessible'); + + $retval = TRUE; + } + } + } + + return($retval); + }//end load_schema() + //========================================================================= + + + + //========================================================================= + /** + * Try to load PL/pgsql functions... + * + * NOTE: this is a terrible requirement, which requires PostgreSQL to be + * compiled with certain options... + */ + private function handle_plpgsql() { + $this->db->beginTrans(); + $fileData = $this->fsObj->read("plpgsql.sql"); + + $numrows = $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror)) { + $this->db->commitTrans(); + $retval = TRUE; + } + else { + //figure out WHY this failed: if they're already loaded it's okay, otherwise it's bad. + $this->db->rollbackTrans(); + + if(preg_match('/"plpgsql_call_handler" already exists/', $dberror)) { + $retval = TRUE; + } + else { + $retval = $dberror; + } + } + + return($retval); + }//end handle_plpgsql() + //========================================================================= +} + ?> \ No newline at end of file Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/includes/setup/3.inc 2008-07-21 03:20:21 UTC (rev 900) @@ -7,8 +7,10 @@ if($_POST) { $validSubmission = test_submitted_data($page, $_POST['users']); - if($validSubmission === TRUE) { - $setupObj->store_setup_data(3, $setupObj->handle_step(3), 'text'); + if($validSubmission === TRUE) { + $obj = new __setupDefaultValues(); + store_setup_data(3, $obj->go(), 'text'); + $obj->finish($page); } else { store_setup_data(3, $_POST['users'], 'post_info'); @@ -25,7 +27,7 @@ $page->conditional_header("/setup/3", TRUE); } else { - $myData = $setupObj->get_setup_data(3, 'post_info'); + $myData = get_setup_data(3, 'post_info'); if(is_array($myData)) { foreach($myData as $num=>$userArr) { foreach($userArr as $userField => $userValue) { @@ -120,4 +122,1046 @@ +class __setupDefaultValues extends upgrade { + + + protected $db; + private $gfObj; + private $totalRecords=0; + + private $data=array(); + + private $lastNumrows=NULL; + private $lastDberror=NULL; + + //========================================================================= + public function __construct() { + $this->db = new cs_phpDB; + $this->gfObj = new cs_globalFunctions; + }//end __construct() + //========================================================================= + + + + //========================================================================= + public function go() { + store_setup_data(3, 0, 'result'); + try { + $params = get_db_params(); + $this->db->connect($params); + $this->db->beginTrans(__METHOD__); + $retval = "Connected successfully to the database."; + + //now that we've connected, start doing stuff. + $retval = $this->set_version(); + $retval .= "<BR>\n". $this->create_log_categories_and_classes(); + $retval .= "<BR>\n". $this->create_record_type_data(); + $retval .= "<BR>\n". $this->create_attributes(); + $retval .= "<BR>\n". $this->create_anonymous_contact_data(); + $retval .= "<BR>\n". $this->create_status_records(); + $retval .= "<BR>\n". $this->create_tag_names(); + $retval .= "<BR>\n". $this->build_preferences(); + $retval .= "<BR>\n". $this->create_users(); + $retval .= "<BR>\n". $this->create_user_group_records(); + + $commitRes = $this->db->commitTrans(); + if($commitRes == 1) { + $retval .= "<BR>\n ----------- Created (". $this->totalRecords ."), result of commit: (". $commitRes .")."; + store_setup_data(3, 1, 'result'); + store_setup_data(4, 1, 'accessible'); + } + else { + $this->db->rollbackTrans(); + store_setup_data(3, 0, 'result'); + throw new exception(__METHOD__ .": failed to commit the transaction (". $commitRes .")"); + } + + } + catch(exception $e) { + //TODO: rollback the transaction + $retval = "An error occurred: ". $e->getMessage(); + } + + return($retval); + + }//end go() + //========================================================================= + + + + //========================================================================= + /** + * Set version information into the database for future upgradeability. + */ + private function set_version() { + //get the version string. + $fullVersionString = read_version_file(); + + $suffixData = explode('-', $fullVersionString); + if(count($suffixData) == 2 && preg_match('/\./', $suffixData[0]) && !preg_match('/\./', $suffixData[1])) { + //there's a suffix, and it doesn't contain periods (i.e. "1.0.0-ALPHA1") + $suffix = $suffixData[1]; + } + elseif(count($suffixData) == 1) { + //no suffix. + $suffix = ""; + } + else { + //there's a dash in the name, but it's invalid or contains periods (i.e. "BETA-1.0.0" or "1.0.0-ALPHA1.0") + throw new exception(__METHOD__ .": version string is invalid (". $fullVersionString ."), suffix contains dashes, or there is a prefix"); + } + + //remove the suffix & parse it. + $versionString = $suffixData[0]; + $versionData = $this->parse_version_string($fullVersionString); + $sqlData = $versionData; + + + #$sqlData = array( + # 'version_string' => $fullVersionString, + # 'version_major' => $versionData[0], + # 'version_minor' => $versionData[1], + # 'version_maintenance' => $versionData[2], + # 'version_suffix' => $suffix + #); + + $retval = 0; + foreach($sqlData as $name => $value) { + $sql = "SELECT internal_data_set_value('". $name ."', '". $value ."')"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to set (". $name .") as (". $value .")::: ". $dberror); + } + } + + if($retval == count($sqlData)) { + //okay, the final test: run a query that straps everything together, to ensure it all has the same version. + $sql = "SELECT internal_data_get_value('version_major') || '.' || internal_data_get_value('version_minor') " . + " || '.' || internal_data_get_value('version_maintenance') as text, " . + "internal_data_get_value('version_suffix') as version_suffix;"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $data = $this->db->farray(); + $dbVersionString = $data['text']; + if(strlen($data['version_suffix'])) { + $dbVersionString .= "-". $data['version_suffix']; + } + + if($dbVersionString === $fullVersionString) { + //okay, one final test: check that the "version_string" in the database matches ours. + $sql = "SELECT internal_data_get_value('version_string')"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $data = $this->db->farray(); + $dbVersionString = $data[0]; + + if($dbVersionString === $fullVersionString) { + $this->data['version_string'] = $fullVersionString; + $retval = "Successfully set version string"; + } + else { + throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve full version_string from database::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve derived database version string::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + //it's cryptic, but what should it really say??? + throw new exception(__METHOD__ .": internal error, checksum didn't match"); + } + + return($retval); + + }//end set_version() + //========================================================================= + + + + //========================================================================= + private function create_log_categories_and_classes() { + + $counter = 0; + + $classes = array( + 1 => 'Error', + 2 => 'Information', + 3 => 'Create', + 4 => 'Update', + 5 => 'Delete', + 6 => 'REPORT', + 7 => 'DEBUG' + ); + + + foreach($classes as $num=>$name) { + $insertArr = array( + 'log_class_id' => $num, + 'name' => $name + ); + $sql = "INSERT INTO log_class_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + //good. + $counter++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to create class record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + + //Reset sequence, so new records can be created. + $sql = "SELECT setval('log_class_table_log_class_id_seq', (SELECT max(log_class_id) FROM log_class_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $categories = array( + 1 => 'Database', + 2 => 'Authentication', + 3 => 'Users', + 4 => 'General', + 5 => 'Project', + 6 => 'Helpdesk', + 7 => 'Task', + 8 => 'Tags', + 9 => 'Estimates', + 10 => 'Navigation', + 11 => 'Preferences' + ); + + + foreach($categories as $num=>$name) { + $insertArr = array( + 'log_category_id' => $num, + 'name' => $name + ); + $sql = "INSERT INTO log_category_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + //good. + $counter++; + $this->totalRecords++; + $this->data['logcat__'. strtolower($name)] = $num; + } + else { + throw new exception(__METHOD__ .": failed to create category record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + //Reset sequence, so new records can be created. + $sql = "SELECT setval('log_category_table_log_category_id_seq', (SELECT max(log_category_id) FROM log_category_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + + //format (primary index is log_event_id): log_class_id, log_category_id, description + $logEvents = array( + // * log_event_id | log_class_id | log_category_id | description + 1 => array(3, 5, 'Project: created record'), + 2 => array(5, 5, 'Project: deleted record'), + 3 => array(4, 5, 'Project: updated record'), + 4 => array(1, 5, 'Project: ERROR'), + 5 => array(3, 6, 'Helpdesk: Created record'), + 6 => array(4, 6, 'Helpdesk: Updated record'), + 7 => array(2, 6, 'Helpdesk: Information'), + 8 => array(1, 6, 'Helpdesk: ERROR'), + 9 => array(6, 6, 'Helpdesk: Report'), + 10 => array(3, 7, 'Task: created record'), + 11 => array(5, 7, 'Task: deleted record'), + 12 => array(4, 7, 'Task: updated record'), + 13 => array(1, 1, 'Database Error'), + 14 => array(6, 5, 'Project: Activity Report'), + 15 => array(6, 7, 'Task: Activity Report'), + 16 => array(3, 2, 'User logged-in'), + 17 => array(5, 2, 'User logged-out'), + 18 => array(6, 2, 'Login/Logout Report'), + 19 => array(3, 8, 'Tags: created record'), + 20 => array(5, 8, 'Tags: deleted record'), + 21 => array(4, 8, 'Tags: updated record'), + 22 => array(6, 8, 'Tags: Activity Report'), + 23 => array(1, 2, 'Authentication: ERROR'), + 24 => array(2, 10, 'Navigation: Viewed page'), + 25 => array(4, 9, 'Update: Estimates'), + 26 => array(1, 9, 'Error: Estimates'), + 27 => array(2, 5, 'Information: Project'), + 28 => array(4, 3, 'Update: Users'), + 29 => array(1, 7, 'Error: Task'), + 30 => array(3, 3, 'Create: Users') + ); + + foreach($logEvents as $logEventId => $subArr) { + $insertArr = array( + 'log_event_id' => $logEventId, + 'log_class_id' => $subArr[0], + 'log_category_id' => $subArr[1], + 'description' => $subArr[2] + ); + $sql = "INSERT INTO log_event_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $counter++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to create log_event_id #". $insertArr['log_event_id'] + .", description: ". $insertArr['description'] ."<BR>\nERROR::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + //FINAL SANITY CHECKS!!! + if($counter == (count($classes) + count($categories) + count($logEvents))) { + + //reset the sequence. + $sql = "SELECT setval('log_event_table_log_event_id_seq', (SELECT max(log_event_id) FROM log_event_table))"; + if($this->run_sql($sql) === TRUE) { + $retval = "Successfully created all category, class, and log event records (". $counter .")"; + } + else { + throw new exception(__METHOD__ .": failed to reset sequence for log_event table::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": Internal error, failed to create all category and class records"); + } + } + else { + throw new exception(__METHOD__ .": failed to reset sequence for log_category_table::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": failed to reset sequence for log_class_table::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + + return($retval); + + }//end create_log_categories_and_classes() + //========================================================================= + + + + //========================================================================= + private function create_record_type_data() { + //format: + // {record_type_id} => array({name}, {module}) + $recordTypes = array( + 1 => array('Project', 'project'), + 2 => array('Task', 'task'), + 3 => array('Helpdesk', 'helpdesk') + ); + + $retval = 0; + foreach($recordTypes as $recTypeId => $subData) { + $insertArr = array( + 'record_type_id' => $recTypeId, + 'name' => $subData[0], + 'module' => $subData[1] + ); + $sql = "INSERT INTO record_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $this->totalRecords++; + $retval++; + $this->data['rectype__'. $insertArr['module']] = $recTypeId; + } + else { + throw new exception(__METHOD__ .": failed to create record for ". $insertArr['name'] + .", dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if(count($recordTypes) == $retval) { + + $sql = "SELECT setval('record_type_table_record_type_id_seq'::text, (SELECT max(record_type_id) FROM record_type_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + if($retval == count($recordTypes)) { + $retval = "Created all record types (". $retval .")"; + } + else { + throw new exception(__METHOD__ .": internal error (sanity check failed)"); + } + } + else { + throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error"); + } + + return($retval); + }//end create_record_type_data() + //========================================================================= + + + + //========================================================================= + private function create_attributes() { + $attributes = array( + 3 => array('phone', 'phone', 'Phone'), + 4 => array('fax', 'phone', 'Fax'), + 5 => array('cell', 'phone', 'Cell'), + 6 => array('im_yahoo', 'alphanumeric', 'IM: Yahoo'), + 7 => array('im_skype', 'alphanumeric', 'IM: Skype'), + 8 => array('im_aol', 'alphanumeric', 'IM: AOL'), + 9 => array('im_msn', 'alphanumeric', 'IM: MSN'), + 10 => array('im_icq', 'alphanumeric', 'IM: ICQ'), + 11 => array('address', 'sql', 'Address'), + 12 => array('city', 'alphanumeric', 'City'), + 13 => array('state', 'alphanumeric', 'State'), + 14 => array('zip', 'alphanumeric', 'Zip') + ); + + $retval = 0; + foreach($attributes as $attributeId => $subData) { + $insertArr = array( + 'attribute_id' => $attributeId, + 'name' => $subData[0], + 'clean_as' => $subData[1], + 'display_name' => $subData[2] + ); + $sql = "INSERT INTO attribute_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to insert data for attribute (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($retval == count($attributes)) { + $sql = "SELECT setval('attribute_table_attribute_id_seq'::text, (SELECT max(attribute_id) FROM attribute_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval = "Successfully created all attributes (". $retval .")!"; + } + else { + throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (sanity check failed)"); + } + + return($retval); + }//end create_attributes() + //========================================================================= + + + + //========================================================================= + /** + * Create the anonymous user. This includes their contact data and the + * default group. + * + * TODO: change "short_name" into "display_name". + */ + private function create_anonymous_contact_data() { + $allRecords = array( + 'disabled group' => array( + 'name' => 'group_table', + 'data' => array( + 'group_id' => 0, + 'name' => 'disabled', + 'short_name' => 'DISABLED', + 'leader_uid' => 0 + ), + ), + 'anonymous record in user table' => array( + 'name' => 'user_table', + 'data' => array( + 'uid' => 0, + 'username' => 'Anonymous', + 'password' => 'disabled', //this is PURPOSELY an invalid password (passwords should be 32-char md5's + 'is_admin' => 'f', + 'is_active' => 'f', + 'group_id' => 0, + 'contact_id' => 0 + ), + ), + 'default group' => array( + 'name' => 'group_table', + 'data' => array( + 'group_id' => 1, + 'name' => 'default', + 'short_name' => '-DEFAULT-', + 'leader_uid' => 0 + ), + ), + 'anonymous contact record' => array( + 'name' => 'contact_table', + 'data' => array( + 'contact_id' => 0, + 'company' => '', + 'fname' => 'Anonymous', + 'lname' => '', + 'contact_email_id' => '-1' + ) + ), + 'anonymous email record' => array( + 'name' => 'contact_email_table', + 'data' => array( + 'contact_id' => 0, + 'email' => 'ano...@nu...' + ) + ) + ); + + $retval = 0; + foreach($allRecords as $operationName => $subData) { + $tableName = $subData['name']; + $insertArr = $subData['data']; + + $sql = "INSERT INTO ". $tableName ." ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $this->totalRecords++; + $retval++; + } else { + throw new exception(__METHOD__. ": failed perform operation (". $operationName .") for table (". $tableName .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + $sql = "SELECT currval('contact_email_table_contact_email_id_seq'::text)"; + if($this->run_sql($sql)) { + $data = $this->db->farray(); + $sql = "UPDATE contact_table SET contact_email_id=". $data[0] ." WHERE contact_id=0"; + if($this->run_sql($sql)) { + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to set contact_email_id for anonymous"); + } + } + else { + throw new exception(__METHOD__ .": failed to get sequence for contact_email_table"); + } + + if($retval == count($allRecords)) { + //reset the sequence for the group table... + $sql = "SELECT setval('group_table_group_id_seq'::text, (SELECT max(group_id) FROM group_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + //good to go. + $retval = "Successfully created anonymous user, anonymous contact record, and the two default groups (". $retval .")!"; + } + else { + throw new exception(__METHOD__ .": failed to reset group sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (failed sanity check)"); + } + + return($retval); + }//end create_anonymous_contact_data() + //========================================================================= + + + //========================================================================= + private function create_status_records() { + //format: {status_id} => array({name}, {description}) + $statuses = array( + 0 => array('New/Offered', 'New record'), + 1 => array('Pending', 'Not new: pending review, or nearly complete.'), + 2 => array('Running/Accepted', 'Work is underway'), + 3 => array('Stalled', 'Unable to complete, or dependent on other things.'), + 4 => array('Ended/Solved', 'Work is complete!'), + 5 => array('Rejected', 'Denied.'), + 6 => array('Re-opened', 'Was solved, but is once again open.'), + ); + + $retval = 0; + foreach($statuses as $statusId => $subData) { + $insertArr = array( + 'status_id' => $statusId, + 'name' => $subData[0], + 'description' => $subData[1] + ); + $sql = "INSERT INTO status_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to create status (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($retval == count($statuses)) { + //reset the status_table.status_id sequence... + $sql = "SELECT setval('status_table_status_id_seq'::text, (SELECT max(status_id) FROM status_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + //good to go. + $retval = "Successfully created all status records (". $retval .")!"; + } + else { + throw new exception(__METHOD__ .": failed to reset status sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (failed sanity check)"); + } + + return($retval); + + }//end create_status_records() + //========================================================================= + + + + //========================================================================= + private function create_tag_names() { + $tags = array( + 1 => 'bug', + 2 => 'feature request', + 3 => 'information', + 4 => 'network related', + 5 => 'critical', + 6 => 'exception' + ); + + $retval = 0; + foreach($tags as $id=>$name) { + $insertArr = array( + 'tag_name_id' => $id, + 'name' => $name + ); + $sql = "INSERT INTO tag_name_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to insert data for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($retval == count($tags)) { + //reset sequence for tag_name_table.tag_name_id + $sql = "SELECT setval('tag_name_table_tag_name_id_seq'::text, (SELECT max(tag_name_id) FROM tag_name_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + //good to go. + $retval = "Successfully created all tags (". $retval .")!"; + } + else { + throw new exception(__METHOD__ .": failed to reset tag_name sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (sanity check failed)"); + } + + return($retval); + }//end create_tag_names() + //========================================================================= + + + + //========================================================================= + private function build_preferences() { + //format: {pref_type_id} => array({name}, {default_value}, {display_name}, {description}) + $prefTypes = array( + 1 => array('startModule', 'helpdesk', 'Starting on Module', 'Defines which section will be loaded upon login if nothing was selected.'), + 5 => array('sorting_helpdesk', 'public_id|DESC', 'Helpdesk Sorting', 'Define the type of sorting for the helpdesk page.'), + 6 => array('sorting_project', 'priority|ASC', 'Project Sorting', 'Define the type of sorting for the helpdesk page.'), + 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\'s details page.'), + 8 => array('projectDetails_showCompletedIssues', '1', 'Project Details: Display completed issues', 'Should completed issues display in the details of a project?') + ); + + $retval = 0; + foreach($prefTypes as $prefTypeId => $subData) { + $insertArr = array( + 'pref_type_id' => $prefTypeId, + 'name' => $subData[0], + 'default_value' => $subData[1], + 'display_name' => $subData[2], + 'description' => $subData[3] + ); + + $sql = "INSERT INTO pref_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to insert data for (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($retval == count($prefTypes)) { + //format: {pref_option_id} => array({pref_type_id}, {name}, {effective_value}) + $prefOptions = array( + 1 =>array(1, 'Helpdesk', 'helpdesk'), + 2 =>array(1, 'Projects', 'project'), + 3 =>array(1, 'Summary ', 'summary'), + 8 =>array(5, 'ID - Descending', 'public_id|DESC'), + 9 =>array(5, 'ID - Ascending', 'public_id|ASC'), + 10 =>array(5, 'Priority - Descending', 'priority|DESC'), + 11 =>array(5, 'Priority - Ascending', 'priority|ASC'), + 12 =>array(5, 'Submit - Descending', 'start_date|DESC'), + 13 =>array(5, 'Submit - Ascending', 'start_date|ASC'), + 14 =>array(5, 'Title - Descending', 'name|DESC'), + 15 =>array(5, 'Title - Ascending', 'name|DESC'), + 16 =>array(5, 'Status ID - Descending', 'status_id|DESC'), + 17 =>array(5, 'Status ID - Ascending', 'status_id|DESC'), + 18 =>array(5, 'Assigned - Descending', 'assigned|DESC'), + 19 =>array(5, 'Assigned - Ascending', 'assigned|DESC'), + 20 =>array(6, 'Priority - Ascending', 'priority|ASC'), + 21 =>array(6, 'Priority - Descending', 'priority|DESC'), + 22 =>array(6, 'Name of Project - Ascending', 'name|ASC'), + 23 =>array(6, 'Name of Project - Descending', 'name|DESC'), + 24 =>array(6, 'Begin - Ascending', 'start_date|ASC'), + 25 =>array(6, 'Begin - Descending', 'start_date|DESC'), + 26 =>array(6, 'End - Ascending', 'end|ASC'), + 27 =>array(6, 'End - Descending', 'end|DESC'), + 28 =>array(6, 'Status ID - Ascending', 'status_id|ASC'), + 29 =>array(6, 'Status ID - Descending', 'status_id|DESC'), + 30 =>array(6, 'Progress - Ascending', 'progress|ASC'), + 31 =>array(6, 'Progress - Descending', 'progress|DESC'), + 32 =>array(6, 'Leader - Ascending', 'leader_contact_id|ASC'), + 33 =>array(6, 'Leader - Descending', 'leader_contact_id|DESC'), + 34 =>array(7, 'Show everything', 'all'), + 35 =>array(7, 'All of mine (created & assigned)', 'mine'), + 36 =>array(7, 'Only my assigned items', 'assigned'), + 37 =>array(8, 'Yes', '1'), + 38 =>array(8, 'No', '0'), + ); + + foreach($prefOptions as $prefOptionId => $subData) { + $insertArr = array( + 'pref_option_id' => $prefOptionId, + 'pref_type_id' => $subData[0], + 'name' => $subData[1], + 'effective_value' => $subData[2] + ); + $sql = "INSERT INTO pref_option_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval++; + $this->totalRecords++; + } + else { + throw new exception(__METHOD__ .": failed to insert data for pref option (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($retval == (count($prefTypes) + count($prefOptions))) { + //reset the pref_type_table.pref_type_id sequence. + $sql = "SELECT setval('pref_type_table_pref_type_id_seq'::text, (SELECT max(pref_type_id) FROM pref_type_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + if($retval == (count($prefTypes) + count($prefOptions))) { + //reset the pref_option_table.pref_option_id sequence. + $sql = "SELECT setval('pref_option_table_pref_option_id_seq'::text, (SELECT max(pref_option_id) FROM pref_option_table))"; + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $retval = "Successfully created all preferences and options (". $retval .")!"; + } + else { + throw new exception(__METHOD__ .": failed to reset the pref_option sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (sanity check #2 failed)"); + } + } + else { + throw new exception(__METHOD__ .": failed to reset pref_type sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": internal error (sanity check #2 failed): (". $retval ." != ". (count($prefTypes) + count($prefOptions)) .")"); + } + } + else { + throw new exception(__METHOD__ .": internal error (sanity check #1 failed)"); + } + + return($retval); + + }//end build_preferences() + //========================================================================= + + + + //========================================================================= + private function create_users() { + + //retrieve the user information. + $userData = get_setup_data(3, 'post_info'); + if(!is_array($userData) || count($userData) != 2) { + throw new exception(__METHOD__ .": no user data...?". $this->gfObj->debug_print($userData,0)); + } + + $counter = 0; + $retval = "Successfully created records for::: "; + foreach($userData as $num => $subData) { + + //split their name up, based upon spaces. + $nameData = explode(' ', $subData['name']); + $insertArr = array(); + if(count($nameData) == 1) { + $insertArr['fname'] = $nameData[0]; + $insertArr['lname'] = ""; + } + elseif(count($nameData) == 2) { + $insertArr['fname'] = $nameData[0]; + $insertArr['lname'] = $nameData[1]; + } + else { + $insertArr['fname'] = $nameData[0]; + $insertArr['lname'] = preg_replace('/^'. $insertArr['fname'] .' /', '', $subData['name']); + } + $insertArr['contact_email_id'] = '-1'; + + //create their contact record. + $sql = "INSERT INTO contact_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + + if(!strlen($dberror) && $numrows == 1) { + $sql = "SELECT currval('contact_table_contact_id_seq'::text)"; + if($this->run_sql($sql, 1) === TRUE) { + $this->totalRecords++; + + $data = $this->db->farray(); + $contactId = $data[0]; + + //now create the user. + $xUser = $subData['username']; + $insertArr = array( + 'username' => $subData['username'], + 'password' => md5($subData['password'] .'_'. $contactId), + 'is_admin' => interpret_bool($subData['is_admin'], array('f', 't')), + 'contact_id' => $contactId + ); + $sql = "INSERT INTO user_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); + + if($this->run_sql($sql, 1) === TRUE) { + $sql = "SELECT currval('user_table_uid_seq'::text)"; + if($this->run_sql($sql,1) === TRUE) { + $data = $this->db->farray(); + $lastUid = $data[0]; + + //create an email address for them. + $sql = "INSERT INTO contact_email_table (contact_id, email) VALUES (". $contactId .", '". strtolower($subData['email']) ."')"; + if($this->run_sql($sql,1) === TRUE) { + $counter++; + //get the newly inserted id, so we can update the contact table. + if($this->run_sql("SELECT currval('contact_email_table_contact_email_id_seq'::text)")) { + $data = $this->db->farray(); + $contactEmailId = $data[0]; + + $sql = "UPDATE contact_table SET contact_email_id=". $contactEmailId ." WHERE contact_id=". $contactId; + if($this->run_sql($sql)) { + $retval = $this->gfObj->create_list($retval, " --- Created record for ". $subData['username'] ." (". $lastUid .")", "<BR>\n"); + } + else { + throw new exception(__METHOD__ .": unable to update contact table with new contact_email_id..."); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve contact_email_id"); + } + } + else { + throw new exception(__METHOD__ .": failed to create email for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": failed to retrieve uid for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": failed to create user record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": unable to retrieve contact_id for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": failed to create contact record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + + if($counter == 2) { + $retval = $this->gfObj->create_list($retval, " --->>> done, created (". $counter .") records", "<BR>\n"); + } + else { + throw new exception(__METHOD__ .": failed to create users (". $counter .")::: ". $this->gfObj->debug_print($userData,0)); + } + + return($retval); + }//end create_users() + //========================================================================= + + + + //========================================================================= + public function finish(cs_genericPage &$page) { + + $stepRes = get_setup_data(3, 'result'); + if($stepRes == 1) { + $page->set_message_wrapper(array( + 'title' => "Successfully Setup Data", + 'message' => "All default data was stored in the new database successfully!", + 'type' => "status" + )); + store_setup_data(3, $this->data, 'data'); + $page->conditional_header("/setup/4", TRUE); + } + else { + $page->set_message_wrapper(array( + 'title' => "Step Failed", + 'message' => "Please review the errors below and proceed accordingly.", + 'type' => "error" + )); + $page->conditional_header("/setup/3", TRUE); + } + + }//end finish() + //========================================================================= + + + + //========================================================================= + protected function run_sql($sql, $expectedNumrows=NULL) { + if(strlen($sql)) { + $numrows = $this->db->exec($sql); + $dberror = $this->db->errorMsg(); + $this->lastNumrows = $numrows; + $this->lastDberror = $dberror; + + if(!strlen($dberror) && $numrows >= 0) { + if(is_numeric($expectedNumrows)) { + if($expectedNumrows == $numrows) { + $retval = TRUE; + } + else { + $retval = FALSE; + } + } + else { + //don't care if it's numeric. + $retval = TRUE; + } + } + else { + throw new exception(__METHOD__ .": failed to run SQL, got numrows=(". $numrows ."), dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); + } + } + else { + throw new exception(__METHOD__ .": no SQL to run..."); + } + + return($retval); + }//end run_sql() + //========================================================================= + + + + //========================================================================= + private function create_user_group_records() { + $sql = "INSERT INTO user_group_table (uid, group_id) SELECT uid, group_id FROM user_table"; + if($this->run_sql($sql, 3) === TRUE) { + $retval = "Successfully created user_group linkage."; + } + else { + throw new exception(__METHOD__ .": unable to create user group records::: ". $this->lastDberror ."<BR>\nSQL::: ". $sql); + } + return($retval); + }//end create_user_group_records() + //========================================================================= + + +}//end __setupDefaultValues{} + + + +class _setupUpgrade extends upgrade { + + public function __construct(cs_phpDB $db) { + $this->db = $db; + parent::__construct(); + }//end __construct() + + public function finalize_conversion() { + $myVersion = parent::read_version_file(); + $setDataResult = parent::run_sql("SELECT internal_data_set_value('converted_from_version', '". parent::read_version_file() ."')"); + parent::update_num_users_to_convert(); + $retval = parent::update_database_version($myVersion); + debug_print(__METHOD__ .": myVersion=(". $myVersion ."), setDataResult=(". $setDataResult ."), retval=(". $retval .")"); + + return($myVersion); + }//end finalize_conversion() +}//end _setupUpgrade{} + ?> Modified: trunk/1.2/includes/setup/5.inc =================================================================== --- trunk/1.2/includes/setup/5.inc 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/includes/setup/5.inc 2008-07-21 03:20:21 UTC (rev 900) @@ -6,10 +6,8 @@ if($_POST) { - #$obj = new __finalStep($page, $stepNames); - #$writeConfigResult = $obj->write_config($page); - $obj = new setup($page); - $writeConfigResult = $obj->handle_step(5, $stepNames); + $obj = new __finalStep($page, $stepNames); + $writeConfigResult = $obj->write_config($page); $page->set_message_wrapper(array( 'title' => "Reloaded... ", @@ -39,4 +37,121 @@ } +class __finalStep { + + + private $page; + private $gfObj; + + + //========================================================================= + public function __construct(cs_genericPage $page, array $stepData) { + $this->page = $page; + $this->stepData = $stepData; + unset($this->stepData[5]); + + $this->gfObj = new cs_globalFunctions; + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../". CONFIG_DIRECTORY); + }//end __construct() + //========================================================================= + + + + //========================================================================= + function write_config() { + if($this->fsObj->is_writable(NULL)) { + $lsData = $this->fsObj->ls(); + if(!is_array($lsData[CONFIG_FILENAME])) { + $myData = array(); + foreach($this->stepData as $stepNum=>$garbage) { + $tempStepData = get_setup_data($stepNum, 'data'); + if(is_array($tempStepData)) { + $myData = array_merge($tempStepData, $myData); + } + else { + throw new exception(__METHOD__ .": step #". $stepNum ." has no valid data... ". $this->gfObj->debug_print($tempStepData,0)); + } + } + + //now that we've built the array successfully, now let's turn it into XML. + $xmlCreator = new xmlCreator('config'); + foreach($myData as $index=>$value) { + $xmlCreator->add_tag($index, $value); + } + $extraAttributes = array( + 'generated' => date('Y-m-d H:m:s'), + 'version' => $myData['version_string'] + ); + $xmlCreator->add_attribute('/config', $extraAttributes); + + //now, create an XML string... + $xmlString = $xmlCreator->create_xml_string(); + + $this->fsObj->create_file(CONFIG_FILENAME, TRUE); + $writeRes = $this->fsObj->write($xmlString, CONFIG_FILENAME); + + if($writeRes > 0) { + $retval = "Successfully created the XML config file"; + store_setup_data(5, 1, 'result'); + store_setup_data(5, $retval, 'text'); + } + else { + throw new exception(__METHOD__ .": failed to write any data to the config file"); + } + } + else { + throw new exception(__METHOD__ .": ". CONFIG_FILE_LOCATION ." already exists!"); + } + } + else { + throw new exception(__METHOD__ .": the config directory is not writable!"); + } + + $configObj = new config(CONFIG_FILE_LOCATION); + $configObj->remove_setup_config(); + + return($retval); + }//end write_config() + //========================================================================= +} + + +//####################################################################################### +/** + * Built to avoid always printing-out the results (so we can retrieve result data separately. + */ +class MyDisplay extends SimpleReporter { + + function paintHeader($test_name) { + } + + function paintFooter($test_name) { + } + + function paintStart($test_name, $size) { + parent::paintStart($test_name, $size); + } + + function paintEnd($test_name, $size) { + parent::paintEnd($test_name, $size); + } + + function paintPass($message) { + parent::paintPass($message); + } + + function paintFail($message) { + parent::paintFail($message); + } +} +//####################################################################################### + + +class unitTest extends UnitTestCase { + + function testOfTester () { + $this->assertTrue(FALSE); + } +} + ?> Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/includes/setup.inc 2008-07-21 03:20:21 UTC (rev 900) @@ -18,13 +18,10 @@ //create the setup object. require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); -require_once(dirname(__FILE__) .'/../lib/setup.class.php'); $configObj = new config(NULL, FALSE); $configData = $configObj->read_config_file(FALSE); -$setupObj = new setup($page); - if(strlen($configData['DATABASE__DBNAME'])) { //setup already complete. Stop 'em. $page->set_message_wrapper(array( @@ -61,7 +58,7 @@ $page->conditional_header("/setup/". $_SESSION['setup']['lastStep'], TRUE); } elseif(count($sectionArr) == 2 && is_numeric($sectionArr[1]) && $sectionArr[1] != 1) { - if(!is_numeric($setupObj->get_setup_data($sectionArr[1], 'accessible'))) { + if(!is_numeric(get_setup_data($sectionArr[1], 'accessible'))) { $page->set_message_wrapper( array( 'title' => "Incomplete Step", @@ -74,7 +71,7 @@ } - $page->add_template_var("VERSION_STRING", $setupObj->read_version_file()); + $page->add_template_var("VERSION_STRING", read_version_file()); $page->rip_all_block_rows('stepData'); $page->clear_content('infobar'); @@ -85,12 +82,12 @@ $tmplStepTitle = "Main Setup Screen"; foreach($stepNames as $num=>$name) { - $stepResult = $setupObj->get_setup_data($num, 'result'); + $stepResult = get_setup_data($num, 'result'); if(!is_numeric($stepResult)) { $passFail = "Incomplete"; $bgColor = "yellow"; - if(strlen($setupObj->get_setup_data($num, 'text'))) { - $stepText = $setupObj->get_setup_data($num, 'text'); + if(strlen(get_setup_data($num, 'text'))) { + $stepText = get_setup_data($num, 'text'); } else { $stepText = "Step incomplete..."; @@ -100,14 +97,14 @@ $passFail = interpret_bool($stepResult, array('FAIL', 'Pass')); $bgColor = interpret_bool($stepResult, array('red', 'green')); - if(strlen($setupObj->get_setup_data($num, 'text'))) { - $stepText = $setupObj->get_setup_data($num, 'text'); + if(strlen(get_setup_data($num, 'text'))) { + $stepText = get_setup_data($num, 'text'); } else { $stepText = " "; } - $setupObj->store_setup_data($num, 1, 'accessible'); + store_setup_data($num, 1, 'accessible'); if($passFail == 'Pass') { $_SESSION['setup']['lastStep'] = $num; } @@ -134,4 +131,144 @@ $page->add_template_var('step_data_row', $myRows); } +//============================================================================= +function store_setup_data($step, $data, $type='data') { + $_SESSION['setup'][$type][$step] = $data; +}//end store_setup_data() +//============================================================================= + + + +//============================================================================= +function get_setup_data($step, $type='data') { + return($_SESSION['setup'][$type][$step]); +}//end get_setup_data() +//============================================================================= + + + +//============================================================================= +function read_version_file() { + $retval = NULL; + $fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/..'); + + //okay, all files present: check the version in the VERSION file. + $lines = $fsObj->read('VERSION', TRUE); + $versionLine = $lines[2]; + if(preg_match('/^VERSION: /', $versionLine)) { + + $retval = trim(preg_replace('/VERSION: /', '', $versionLine)); + } + else { + throw new exception(__METHOD__ .": could not find VERSION data"); + } + + return($retval); +}//end read_version_file() +//============================================================================= + + + +//============================================================================= +function get_db_params() { + + $stepOneData = get_setup_data(1, 'data'); + if(is_array($stepOneData)) { + $params = array(); + foreach($stepOneData as $name=>$value) { + $index = preg_replace('/^database__/', '', $name); + $params[$index] = $value; + } + } + else { + throw new exception(__FUNCTION__ .": unable to retrieve step one data..."); + } + + return($params); +}//end get_db_params() +//============================================================================= + + + +//============================================================================= +function reset_all_steps($leaveText=TRUE, $afterStep=NULL) { + $retval=0; + if(is_array($_SESSION['setup'])) { + if(is_numeric($afterStep)) { + $_SESSION['setup']['lastStep'] = $afterStep; + } + else { + $_SESSION['setup']['lastStep'] = 1; + } + $unsetThis = array('data', 'result', 'accessible'); + + if($leaveText !== TRUE) { + $unsetThis[] = 'text'; + } + foreach($unsetThis as $indexName) { + if(isset($_SESSION['setup'][$indexName])) { + if(is_numeric($afterStep)) { + foreach($_SESSION['setup'][$indexName] as $stepNum=>$stepData) { + if(is_numeric($stepNum) && $stepNum > $afterStep) { + unset($_SESSION['setup'][$indexName][$stepNum]); + $retval++; + } + } + } + else { + unset($_SESSION['setup'][$indexName]); + $retval++; + } + } + } + } + else { + throw new exception(__FUNCTION__ .": no step data found in session"); + } + + return($retval); +}//end reset_all_steps() +//============================================================================= + + + +//============================================================================= +function test_db_stuff(cs_phpDB &$db=NULL) { + if(is_null($db) || !is_object($db)) { + $db = new cs_phpDB; + } + $stepOneData = get_setup_data(1); + $params = get_db_params(); + $originalParams = $params; + + + + $params['dbname'] = 'template1'; + $retval = "Failed to connect to ". $params['host'] .":". $params['dbname'] ." (host connection failed)"; + + $gf = new cs_globalFunctions; + + try { + $db->connect($params); + $result = "Connected successfully to ". $params['host'] .":". $params['dbname'] ." (host connection good)"; + try { + $newParams = $originalParams; + $db2 = new cs_phpDB; + $db2->connect($originalParams ); + $retval = "Connected successfully to ". $newParams['host'] .":". $newParams['dbname'] ." (host connection good, DATABASE EXISTS)"; + } + catch(exception $e) { + //no database! + //TODO: do a preg_match() on $e->getMessage() to see if it says something about the database not existing + $retval = TRUE; + } + } + catch(exception $e) { + $retval = $e->getMessage(); + } + + return($retval); +}//end test_db_stuff() +//============================================================================= + ?> \ No newline at end of file Deleted: trunk/1.2/lib/setup.class.php =================================================================== --- trunk/1.2/lib/setup.class.php 2008-07-21 02:17:54 UTC (rev 899) +++ trunk/1.2/lib/setup.class.php 2008-07-21 03:20:21 UTC (rev 900) @@ -1,1637 +0,0 @@ -<?php -/* - * SVN INFORMATION::: - * ------------------ - * SVN Signature::::::: $Id$ - * Last Author::::::::: $Author$ - * Current Revision:::: $Revision$ - * Repository Location: $HeadURL$ - * Last Updated:::::::: $Date$ - */ - - -require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); -require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); - - -class setup { - - private $pageObj; - private $dbObj; - - //============================================================================= - function __construct(cs_genericPage $page, cs_phpDB $db=NULL) { - $this->pageObj = $page; - - //TODO: determine what step we're on (if > 1, can connect db) - try { - $connectionParams = $this->get_db_params(); - - //TODO: make this a setup parameter (so we can integrate with mysql). - $this->dbObj = new cs_phpDB('pgsql'); - $this->dbObj->connect($connectionParams); - } - catch(exception $e) { - } - }//end __construct() - //============================================================================= - - - - //============================================================================= - function store_setup_data($step, $data, $type='data') { - $_SESSION['setup'][$type][$step] = $data; - }//end store_setup_data() - //============================================================================= - - - - //============================================================================= - function get_setup_data($step, $type='data') { - return($_SESSION['setup'][$type][$step]); - }//end get_setup_data() - //============================================================================= - - - - //============================================================================= - function read_version_file() { - $retval = NULL... [truncated message content] |
From: <cra...@us...> - 2008-07-21 02:18:22
|
Revision: 899 http://cs-project.svn.sourceforge.net/cs-project/?rev=899&view=rev Author: crazedsanity Date: 2008-07-21 02:17:54 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Update cs-content to 0.10.12. Modified Paths: -------------- trunk/1.2/lib/globalFunctions.php Modified: trunk/1.2/lib/globalFunctions.php =================================================================== --- trunk/1.2/lib/globalFunctions.php 2008-05-20 19:03:51 UTC (rev 898) +++ trunk/1.2/lib/globalFunctions.php 2008-07-21 02:17:54 UTC (rev 899) @@ -17,9 +17,9 @@ function get_required_external_lib_versions($projectName=NULL) { //format: {className} => array({projectName} => {exactVersion}) $requirements = array( - 'contentSystem' => array('cs-content', '0.10.11'), + 'contentSystem' => array('cs-content', '0.10.12'), 'XMLParser' => array('cs-phpxml', '0.5.6'), - 'arrayToPath' => array('cs-arrayToPath', '0.2.2') + 'arrayToPath' => array('cs-arrayToPath', '0.2.2') ); if(!is_null($projectName)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-20 19:03:54
|
Revision: 898 http://cs-project.svn.sourceforge.net/cs-project/?rev=898&view=rev Author: crazedsanity Date: 2008-05-20 12:03:51 -0700 (Tue, 20 May 2008) Log Message: ----------- More consolidation. Things still are pointing to global functions instead of the class... more work to do! Modified Paths: -------------- trunk/1.2/includes/setup/1.inc trunk/1.2/includes/setup/2.inc trunk/1.2/includes/setup/3.inc trunk/1.2/includes/setup.inc trunk/1.2/lib/setup.class.php Modified: trunk/1.2/includes/setup/1.inc =================================================================== --- trunk/1.2/includes/setup/1.inc 2008-05-20 18:48:23 UTC (rev 897) +++ trunk/1.2/includes/setup/1.inc 2008-05-20 19:03:51 UTC (rev 898) @@ -10,14 +10,14 @@ if($_POST) { reset_all_steps(FALSE); - store_setup_data(1, $_POST['fields']); - $dbTestRes = test_db_stuff(); + $setupObj->store_setup_data(1, $_POST['fields']); + $dbTestRes = $setupObj->test_db_stuff(); if($dbTestRes === TRUE) { - store_setup_data(1, 1, 'result'); - store_setup_data(1, 'Values stored successfully', 'text'); + $setupObj->store_setup_data(1, 1, 'result'); + $setupObj->store_setup_data(1, 'Values stored successfully', 'text'); //set the next step as accessible. - store_setup_data(2, 1, 'accessible'); + $setupObj->store_setup_data(2, 1, 'accessible'); //TODO: consider moving the database connectivity tests into this step (and alter the status message below accordingly). $page->set_message_wrapper(array( @@ -29,8 +29,8 @@ } else { //oops... - store_setup_data(1, 0, 'result'); - store_setup_data(1, $dbTestRes, 'text'); + $setupObj->store_setup_data(1, 0, 'result'); + $setupObj->store_setup_data(1, $dbTestRes, 'text'); $page->set_message_wrapper(array( 'title' => "Failure", @@ -52,7 +52,7 @@ )); } - $setupData = get_setup_data(1,'data'); + $setupData = $setupObj->get_setup_data(1,'data'); if(!is_array($setupData) || !count($setupData)) { //provide some defaults. $setupData = array( Modified: trunk/1.2/includes/setup/2.inc =================================================================== --- trunk/1.2/includes/setup/2.inc 2008-05-20 18:48:23 UTC (rev 897) +++ trunk/1.2/includes/setup/2.inc 2008-05-20 19:03:51 UTC (rev 898) @@ -7,15 +7,15 @@ if($_POST) { //check that step 1 was successful. - reset_all_steps(FALSE, 2); - $stepOneData = get_setup_data(1, 'data'); - if(get_setup_data(1, 'result')) { + $setupObj->reset_all_steps(FALSE, 2); + $stepOneData = $setupObj->get_setup_data(1, 'data'); + if($setupObj->get_setup_data(1, 'result')) { //first, check to see if we can connect to the host's "template1" database. $db = new cs_phpDB; - store_setup_data(2, 0, 'result'); - $result = test_db_stuff($db); + $setupObj->store_setup_data(2, 0, 'result'); + $result = $setupObj->test_db_stuff($db); if($result === TRUE) { //Good to go: load the schema! @@ -34,7 +34,7 @@ } else { //not so good. Go back to step 1, so they can make changes. - $params = get_setup_data(1, 'data'); + $params = $setupObj->get_setup_data(1, 'data'); $page->set_message_wrapper( array( 'title' => "Test Failed", Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-05-20 18:48:23 UTC (rev 897) +++ trunk/1.2/includes/setup/3.inc 2008-05-20 19:03:51 UTC (rev 898) @@ -8,8 +8,7 @@ if($_POST) { $validSubmission = test_submitted_data($page, $_POST['users']); if($validSubmission === TRUE) { - $obj = new setup($page); - store_setup_data(3, $obj->handle_step(3), 'text'); + $setupObj->store_setup_data(3, $setupObj->handle_step(3), 'text'); } else { store_setup_data(3, $_POST['users'], 'post_info'); @@ -26,7 +25,7 @@ $page->conditional_header("/setup/3", TRUE); } else { - $myData = get_setup_data(3, 'post_info'); + $myData = $setupObj->get_setup_data(3, 'post_info'); if(is_array($myData)) { foreach($myData as $num=>$userArr) { foreach($userArr as $userField => $userValue) { Modified: trunk/1.2/includes/setup.inc =================================================================== --- trunk/1.2/includes/setup.inc 2008-05-20 18:48:23 UTC (rev 897) +++ trunk/1.2/includes/setup.inc 2008-05-20 19:03:51 UTC (rev 898) @@ -18,10 +18,13 @@ //create the setup object. require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); +require_once(dirname(__FILE__) .'/../lib/setup.class.php'); $configObj = new config(NULL, FALSE); $configData = $configObj->read_config_file(FALSE); +$setupObj = new setup($page); + if(strlen($configData['DATABASE__DBNAME'])) { //setup already complete. Stop 'em. $page->set_message_wrapper(array( @@ -58,7 +61,7 @@ $page->conditional_header("/setup/". $_SESSION['setup']['lastStep'], TRUE); } elseif(count($sectionArr) == 2 && is_numeric($sectionArr[1]) && $sectionArr[1] != 1) { - if(!is_numeric(get_setup_data($sectionArr[1], 'accessible'))) { + if(!is_numeric($setupObj->get_setup_data($sectionArr[1], 'accessible'))) { $page->set_message_wrapper( array( 'title' => "Incomplete Step", @@ -71,7 +74,7 @@ } - $page->add_template_var("VERSION_STRING", read_version_file()); + $page->add_template_var("VERSION_STRING", $setupObj->read_version_file()); $page->rip_all_block_rows('stepData'); $page->clear_content('infobar'); @@ -82,12 +85,12 @@ $tmplStepTitle = "Main Setup Screen"; foreach($stepNames as $num=>$name) { - $stepResult = get_setup_data($num, 'result'); + $stepResult = $setupObj->get_setup_data($num, 'result'); if(!is_numeric($stepResult)) { $passFail = "Incomplete"; $bgColor = "yellow"; - if(strlen(get_setup_data($num, 'text'))) { - $stepText = get_setup_data($num, 'text'); + if(strlen($setupObj->get_setup_data($num, 'text'))) { + $stepText = $setupObj->get_setup_data($num, 'text'); } else { $stepText = "Step incomplete..."; @@ -97,14 +100,14 @@ $passFail = interpret_bool($stepResult, array('FAIL', 'Pass')); $bgColor = interpret_bool($stepResult, array('red', 'green')); - if(strlen(get_setup_data($num, 'text'))) { - $stepText = get_setup_data($num, 'text'); + if(strlen($setupObj->get_setup_data($num, 'text'))) { + $stepText = $setupObj->get_setup_data($num, 'text'); } else { $stepText = " "; } - store_setup_data($num, 1, 'accessible'); + $setupObj->store_setup_data($num, 1, 'accessible'); if($passFail == 'Pass') { $_SESSION['setup']['lastStep'] = $num; } @@ -131,144 +134,4 @@ $page->add_template_var('step_data_row', $myRows); } -//============================================================================= -function store_setup_data($step, $data, $type='data') { - $_SESSION['setup'][$type][$step] = $data; -}//end store_setup_data() -//============================================================================= - - - -//============================================================================= -function get_setup_data($step, $type='data') { - return($_SESSION['setup'][$type][$step]); -}//end get_setup_data() -//============================================================================= - - - -//============================================================================= -function read_version_file() { - $retval = NULL; - $fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/..'); - - //okay, all files present: check the version in the VERSION file. - $lines = $fsObj->read('VERSION', TRUE); - $versionLine = $lines[2]; - if(preg_match('/^VERSION: /', $versionLine)) { - - $retval = trim(preg_replace('/VERSION: /', '', $versionLine)); - } - else { - throw new exception(__METHOD__ .": could not find VERSION data"); - } - - return($retval); -}//end read_version_file() -//============================================================================= - - - -//============================================================================= -function get_db_params() { - - $stepOneData = get_setup_data(1, 'data'); - if(is_array($stepOneData)) { - $params = array(); - foreach($stepOneData as $name=>$value) { - $index = preg_replace('/^database__/', '', $name); - $params[$index] = $value; - } - } - else { - throw new exception(__FUNCTION__ .": unable to retrieve step one data..."); - } - - return($params); -}//end get_db_params() -//============================================================================= - - - -//============================================================================= -function reset_all_steps($leaveText=TRUE, $afterStep=NULL) { - $retval=0; - if(is_array($_SESSION['setup'])) { - if(is_numeric($afterStep)) { - $_SESSION['setup']['lastStep'] = $afterStep; - } - else { - $_SESSION['setup']['lastStep'] = 1; - } - $unsetThis = array('data', 'result', 'accessible'); - - if($leaveText !== TRUE) { - $unsetThis[] = 'text'; - } - foreach($unsetThis as $indexName) { - if(isset($_SESSION['setup'][$indexName])) { - if(is_numeric($afterStep)) { - foreach($_SESSION['setup'][$indexName] as $stepNum=>$stepData) { - if(is_numeric($stepNum) && $stepNum > $afterStep) { - unset($_SESSION['setup'][$indexName][$stepNum]); - $retval++; - } - } - } - else { - unset($_SESSION['setup'][$indexName]); - $retval++; - } - } - } - } - else { - throw new exception(__FUNCTION__ .": no step data found in session"); - } - - return($retval); -}//end reset_all_steps() -//============================================================================= - - - -//============================================================================= -function test_db_stuff(cs_phpDB &$db=NULL) { - if(is_null($db) || !is_object($db)) { - $db = new cs_phpDB; - } - $stepOneData = get_setup_data(1); - $params = get_db_params(); - $originalParams = $params; - - - - $params['dbname'] = 'template1'; - $retval = "Failed to connect to ". $params['host'] .":". $params['dbname'] ." (host connection failed)"; - - $gf = new cs_globalFunctions; - - try { - $db->connect($params); - $result = "Connected successfully to ". $params['host'] .":". $params['dbname'] ." (host connection good)"; - try { - $newParams = $originalParams; - $db2 = new cs_phpDB; - $db2->connect($originalParams ); - $retval = "Connected successfully to ". $newParams['host'] .":". $newParams['dbname'] ." (host connection good, DATABASE EXISTS)"; - } - catch(exception $e) { - //no database! - //TODO: do a preg_match() on $e->getMessage() to see if it says something about the database not existing - $retval = TRUE; - } - } - catch(exception $e) { - $retval = $e->getMessage(); - } - - return($retval); -}//end test_db_stuff() -//============================================================================= - ?> \ No newline at end of file Modified: trunk/1.2/lib/setup.class.php =================================================================== --- trunk/1.2/lib/setup.class.php 2008-05-20 18:48:23 UTC (rev 897) +++ trunk/1.2/lib/setup.class.php 2008-05-20 19:03:51 UTC (rev 898) @@ -22,7 +22,17 @@ //============================================================================= function __construct(cs_genericPage $page, cs_phpDB $db=NULL) { $this->pageObj = $page; - $this->dbObj = $db; + + //TODO: determine what step we're on (if > 1, can connect db) + try { + $connectionParams = $this->get_db_params(); + + //TODO: make this a setup parameter (so we can integrate with mysql). + $this->dbObj = new cs_phpDB('pgsql'); + $this->dbObj->connect($connectionParams); + } + catch(exception $e) { + } }//end __construct() //============================================================================= @@ -134,8 +144,8 @@ if(is_null($db) || !is_object($db)) { $db = new cs_phpDB; } - $stepOneData = get_setup_data(1); - $params = get_db_params(); + $stepOneData = $this->get_setup_data(1); + $params = $this->get_db_params(); $originalParams = $params; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-20 18:48:29
|
Revision: 897 http://cs-project.svn.sourceforge.net/cs-project/?rev=897&view=rev Author: crazedsanity Date: 2008-05-20 11:48:23 -0700 (Tue, 20 May 2008) Log Message: ----------- First step into consolidating setup into a class to handle automatic setup system. I'm not sure if this will all remain in a main class, or if it will be separated into special class files in a sub directory of /lib... we'll see. Modified Paths: -------------- trunk/1.2/includes/setup/2.inc trunk/1.2/includes/setup/3.inc trunk/1.2/includes/setup/5.inc Added Paths: ----------- trunk/1.2/lib/setup.class.php Modified: trunk/1.2/includes/setup/2.inc =================================================================== --- trunk/1.2/includes/setup/2.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/2.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -20,9 +20,8 @@ if($result === TRUE) { //Good to go: load the schema! - //now create a temporary local class that does the rest. - $obj = new __tmpSetupClass($db, $page); - $finalResult = $obj->go(); + $obj = new setup($page, $db); + $finalResult = $obj->handle_step(2); $page->set_message_wrapper( array( @@ -56,191 +55,4 @@ - -class __tmpSetupClass { - - - private $db; - private $fs; - private $page; - private $url = "/setup/1"; - - //========================================================================= - public function __construct(cs_phpDB &$db, cs_genericPage &$page) { - $this->db = $db; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../../docs/sql/setup'); - $this->gfObj = new cs_globalFunctions; - $this->page = $page; - - store_setup_data(2, 0, 'result'); - store_setup_data(2, 'Initializing...', 'text'); - }//end __construct() - //========================================================================= - - - //========================================================================= - public function go() { - $retval = "Nothing done... something went horribly wrong."; - if($this->create_database()) { - $retval = $this->handle_plpgsql(); - - if($retval === TRUE) { - $retval = $this->load_schema(); - if($retval === TRUE) { - $this->page->set_message_wrapper( - array( - 'title' => "Step Successful", - 'message' => "Finished step two with result:::<BR>\n". get_setup_data(2,'text'), - 'type' => "status" - ) - ); - $this->page->conditional_header('/setup/3', TRUE); - } - else { - $retval = "There was an error while testing PL/PGSQL functionality: ". $retval; - store_setup_data(2, $retval, 'text'); - } - } - } - else { - store_setup_data(2, 0, 'result'); - store_setup_data(2, 'Failed to create database', 'text'); - $setupData = get_setup_data(1, 'data'); - $retval = "Unable to create database... check that ". $setupData['host'] . - " does not already have a database named '". $setupData['dbname'] ."'. " . - "Also, make sure no other user is connected to template1."; - } - - return($retval); - }//end go() - //========================================================================= - - - - //========================================================================= - private function create_database() { - $params = get_db_params(); - - //okay, let's try to create the database. - $numrows = $this->db->exec("CREATE DATABASE ". $params['dbname'] ." WITH ENCODING='SQL_ASCII'"); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $retval = FALSE; - } - else { - $retval = TRUE; - - //okay. Now destroy our database handle & create a new one, connected to the proper database. - unset($this->db); - $this->db = new cs_phpDb; - $this->db->connect(get_db_params()); - } - - return($retval); - }//end create_database() - //========================================================================= - - - //========================================================================= - private function load_schema() { - - store_setup_data(2, "Schema not loaded... ", 'text'); - store_setup_data(2, 0, 'result'); - - $fileData = $this->fsObj->read("01__storedprocs.sql"); - - //now we'll try to push that into the database. - $this->db->beginTrans(); - - $this->gfObj->debug_print("Loading stored procedures... "); - - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - //keep going - $retval = "Successfully loaded stored procedures! Loading tables...."; - $this->gfObj->debug_print($retval); - - $fileData = $this->fsObj->read("02__tables.sql"); - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - $retval = "Done loading tables!!! Creating indexes and miscellaneous other things..."; - $this->gfObj->debug_print($retval); - - $fileData = $this->fsObj->read("03__indexes_etc.sql"); - $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(strlen($dberror)) { - $this->db->rollbackTrans(); - $retval = $dberror; - } - else { - $retval = "All stored procedures, tables, and indexes have been created!"; - $this->gfObj->debug_print($retval); - - $this->db->commitTrans(); - store_setup_data(2, array(), 'data'); - store_setup_data(2, 1, 'result'); - store_setup_data(2, $retval, 'text'); - store_setup_data(3, 1, 'accessible'); - - $retval = TRUE; - } - } - } - - return($retval); - }//end load_schema() - //========================================================================= - - - - //========================================================================= - /** - * Try to load PL/pgsql functions... - * - * NOTE: this is a terrible requirement, which requires PostgreSQL to be - * compiled with certain options... - */ - private function handle_plpgsql() { - $this->db->beginTrans(); - $fileData = $this->fsObj->read("plpgsql.sql"); - - $numrows = $this->db->exec($fileData); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror)) { - $this->db->commitTrans(); - $retval = TRUE; - } - else { - //figure out WHY this failed: if they're already loaded it's okay, otherwise it's bad. - $this->db->rollbackTrans(); - - if(preg_match('/"plpgsql_call_handler" already exists/', $dberror)) { - $retval = TRUE; - } - else { - $retval = $dberror; - } - } - - return($retval); - }//end handle_plpgsql() - //========================================================================= -} - ?> \ No newline at end of file Modified: trunk/1.2/includes/setup/3.inc =================================================================== --- trunk/1.2/includes/setup/3.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/3.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -7,10 +7,9 @@ if($_POST) { $validSubmission = test_submitted_data($page, $_POST['users']); - if($validSubmission === TRUE) { - $obj = new __setupDefaultValues(); - store_setup_data(3, $obj->go(), 'text'); - $obj->finish($page); + if($validSubmission === TRUE) { + $obj = new setup($page); + store_setup_data(3, $obj->handle_step(3), 'text'); } else { store_setup_data(3, $_POST['users'], 'post_info'); @@ -122,1046 +121,4 @@ -class __setupDefaultValues extends upgrade { - - - protected $db; - private $gfObj; - private $totalRecords=0; - - private $data=array(); - - private $lastNumrows=NULL; - private $lastDberror=NULL; - - //========================================================================= - public function __construct() { - $this->db = new cs_phpDB; - $this->gfObj = new cs_globalFunctions; - }//end __construct() - //========================================================================= - - - - //========================================================================= - public function go() { - store_setup_data(3, 0, 'result'); - try { - $params = get_db_params(); - $this->db->connect($params); - $this->db->beginTrans(__METHOD__); - $retval = "Connected successfully to the database."; - - //now that we've connected, start doing stuff. - $retval = $this->set_version(); - $retval .= "<BR>\n". $this->create_log_categories_and_classes(); - $retval .= "<BR>\n". $this->create_record_type_data(); - $retval .= "<BR>\n". $this->create_attributes(); - $retval .= "<BR>\n". $this->create_anonymous_contact_data(); - $retval .= "<BR>\n". $this->create_status_records(); - $retval .= "<BR>\n". $this->create_tag_names(); - $retval .= "<BR>\n". $this->build_preferences(); - $retval .= "<BR>\n". $this->create_users(); - $retval .= "<BR>\n". $this->create_user_group_records(); - - $commitRes = $this->db->commitTrans(); - if($commitRes == 1) { - $retval .= "<BR>\n ----------- Created (". $this->totalRecords ."), result of commit: (". $commitRes .")."; - store_setup_data(3, 1, 'result'); - store_setup_data(4, 1, 'accessible'); - } - else { - $this->db->rollbackTrans(); - store_setup_data(3, 0, 'result'); - throw new exception(__METHOD__ .": failed to commit the transaction (". $commitRes .")"); - } - - } - catch(exception $e) { - //TODO: rollback the transaction - $retval = "An error occurred: ". $e->getMessage(); - } - - return($retval); - - }//end go() - //========================================================================= - - - - //========================================================================= - /** - * Set version information into the database for future upgradeability. - */ - private function set_version() { - //get the version string. - $fullVersionString = read_version_file(); - - $suffixData = explode('-', $fullVersionString); - if(count($suffixData) == 2 && preg_match('/\./', $suffixData[0]) && !preg_match('/\./', $suffixData[1])) { - //there's a suffix, and it doesn't contain periods (i.e. "1.0.0-ALPHA1") - $suffix = $suffixData[1]; - } - elseif(count($suffixData) == 1) { - //no suffix. - $suffix = ""; - } - else { - //there's a dash in the name, but it's invalid or contains periods (i.e. "BETA-1.0.0" or "1.0.0-ALPHA1.0") - throw new exception(__METHOD__ .": version string is invalid (". $fullVersionString ."), suffix contains dashes, or there is a prefix"); - } - - //remove the suffix & parse it. - $versionString = $suffixData[0]; - $versionData = $this->parse_version_string($fullVersionString); - $sqlData = $versionData; - - - #$sqlData = array( - # 'version_string' => $fullVersionString, - # 'version_major' => $versionData[0], - # 'version_minor' => $versionData[1], - # 'version_maintenance' => $versionData[2], - # 'version_suffix' => $suffix - #); - - $retval = 0; - foreach($sqlData as $name => $value) { - $sql = "SELECT internal_data_set_value('". $name ."', '". $value ."')"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to set (". $name .") as (". $value .")::: ". $dberror); - } - } - - if($retval == count($sqlData)) { - //okay, the final test: run a query that straps everything together, to ensure it all has the same version. - $sql = "SELECT internal_data_get_value('version_major') || '.' || internal_data_get_value('version_minor') " . - " || '.' || internal_data_get_value('version_maintenance') as text, " . - "internal_data_get_value('version_suffix') as version_suffix;"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $data = $this->db->farray(); - $dbVersionString = $data['text']; - if(strlen($data['version_suffix'])) { - $dbVersionString .= "-". $data['version_suffix']; - } - - if($dbVersionString === $fullVersionString) { - //okay, one final test: check that the "version_string" in the database matches ours. - $sql = "SELECT internal_data_get_value('version_string')"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $data = $this->db->farray(); - $dbVersionString = $data[0]; - - if($dbVersionString === $fullVersionString) { - $this->data['version_string'] = $fullVersionString; - $retval = "Successfully set version string"; - } - else { - throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve full version_string from database::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": derived database version string (". $dbVersionString .") doesn't match our version (". $fullVersionString .")"); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve derived database version string::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - //it's cryptic, but what should it really say??? - throw new exception(__METHOD__ .": internal error, checksum didn't match"); - } - - return($retval); - - }//end set_version() - //========================================================================= - - - - //========================================================================= - private function create_log_categories_and_classes() { - - $counter = 0; - - $classes = array( - 1 => 'Error', - 2 => 'Information', - 3 => 'Create', - 4 => 'Update', - 5 => 'Delete', - 6 => 'REPORT', - 7 => 'DEBUG' - ); - - - foreach($classes as $num=>$name) { - $insertArr = array( - 'log_class_id' => $num, - 'name' => $name - ); - $sql = "INSERT INTO log_class_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good. - $counter++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create class record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - - //Reset sequence, so new records can be created. - $sql = "SELECT setval('log_class_table_log_class_id_seq', (SELECT max(log_class_id) FROM log_class_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $categories = array( - 1 => 'Database', - 2 => 'Authentication', - 3 => 'Users', - 4 => 'General', - 5 => 'Project', - 6 => 'Helpdesk', - 7 => 'Task', - 8 => 'Tags', - 9 => 'Estimates', - 10 => 'Navigation', - 11 => 'Preferences' - ); - - - foreach($categories as $num=>$name) { - $insertArr = array( - 'log_category_id' => $num, - 'name' => $name - ); - $sql = "INSERT INTO log_category_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good. - $counter++; - $this->totalRecords++; - $this->data['logcat__'. strtolower($name)] = $num; - } - else { - throw new exception(__METHOD__ .": failed to create category record for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - //Reset sequence, so new records can be created. - $sql = "SELECT setval('log_category_table_log_category_id_seq', (SELECT max(log_category_id) FROM log_category_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - - //format (primary index is log_event_id): log_class_id, log_category_id, description - $logEvents = array( - // * log_event_id | log_class_id | log_category_id | description - 1 => array(3, 5, 'Project: created record'), - 2 => array(5, 5, 'Project: deleted record'), - 3 => array(4, 5, 'Project: updated record'), - 4 => array(1, 5, 'Project: ERROR'), - 5 => array(3, 6, 'Helpdesk: Created record'), - 6 => array(4, 6, 'Helpdesk: Updated record'), - 7 => array(2, 6, 'Helpdesk: Information'), - 8 => array(1, 6, 'Helpdesk: ERROR'), - 9 => array(6, 6, 'Helpdesk: Report'), - 10 => array(3, 7, 'Task: created record'), - 11 => array(5, 7, 'Task: deleted record'), - 12 => array(4, 7, 'Task: updated record'), - 13 => array(1, 1, 'Database Error'), - 14 => array(6, 5, 'Project: Activity Report'), - 15 => array(6, 7, 'Task: Activity Report'), - 16 => array(3, 2, 'User logged-in'), - 17 => array(5, 2, 'User logged-out'), - 18 => array(6, 2, 'Login/Logout Report'), - 19 => array(3, 8, 'Tags: created record'), - 20 => array(5, 8, 'Tags: deleted record'), - 21 => array(4, 8, 'Tags: updated record'), - 22 => array(6, 8, 'Tags: Activity Report'), - 23 => array(1, 2, 'Authentication: ERROR'), - 24 => array(2, 10, 'Navigation: Viewed page'), - 25 => array(4, 9, 'Update: Estimates'), - 26 => array(1, 9, 'Error: Estimates'), - 27 => array(2, 5, 'Information: Project'), - 28 => array(4, 3, 'Update: Users'), - 29 => array(1, 7, 'Error: Task'), - 30 => array(3, 3, 'Create: Users') - ); - - foreach($logEvents as $logEventId => $subArr) { - $insertArr = array( - 'log_event_id' => $logEventId, - 'log_class_id' => $subArr[0], - 'log_category_id' => $subArr[1], - 'description' => $subArr[2] - ); - $sql = "INSERT INTO log_event_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $counter++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create log_event_id #". $insertArr['log_event_id'] - .", description: ". $insertArr['description'] ."<BR>\nERROR::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - //FINAL SANITY CHECKS!!! - if($counter == (count($classes) + count($categories) + count($logEvents))) { - - //reset the sequence. - $sql = "SELECT setval('log_event_table_log_event_id_seq', (SELECT max(log_event_id) FROM log_event_table))"; - if($this->run_sql($sql) === TRUE) { - $retval = "Successfully created all category, class, and log event records (". $counter .")"; - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_event table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": Internal error, failed to create all category and class records"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_category_table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence for log_class_table::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - - return($retval); - - }//end create_log_categories_and_classes() - //========================================================================= - - - - //========================================================================= - private function create_record_type_data() { - //format: - // {record_type_id} => array({name}, {module}) - $recordTypes = array( - 1 => array('Project', 'project'), - 2 => array('Task', 'task'), - 3 => array('Helpdesk', 'helpdesk') - ); - - $retval = 0; - foreach($recordTypes as $recTypeId => $subData) { - $insertArr = array( - 'record_type_id' => $recTypeId, - 'name' => $subData[0], - 'module' => $subData[1] - ); - $sql = "INSERT INTO record_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $this->totalRecords++; - $retval++; - $this->data['rectype__'. $insertArr['module']] = $recTypeId; - } - else { - throw new exception(__METHOD__ .": failed to create record for ". $insertArr['name'] - .", dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if(count($recordTypes) == $retval) { - - $sql = "SELECT setval('record_type_table_record_type_id_seq'::text, (SELECT max(record_type_id) FROM record_type_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - if($retval == count($recordTypes)) { - $retval = "Created all record types (". $retval .")"; - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error"); - } - - return($retval); - }//end create_record_type_data() - //========================================================================= - - - - //========================================================================= - private function create_attributes() { - $attributes = array( - 3 => array('phone', 'phone', 'Phone'), - 4 => array('fax', 'phone', 'Fax'), - 5 => array('cell', 'phone', 'Cell'), - 6 => array('im_yahoo', 'alphanumeric', 'IM: Yahoo'), - 7 => array('im_skype', 'alphanumeric', 'IM: Skype'), - 8 => array('im_aol', 'alphanumeric', 'IM: AOL'), - 9 => array('im_msn', 'alphanumeric', 'IM: MSN'), - 10 => array('im_icq', 'alphanumeric', 'IM: ICQ'), - 11 => array('address', 'sql', 'Address'), - 12 => array('city', 'alphanumeric', 'City'), - 13 => array('state', 'alphanumeric', 'State'), - 14 => array('zip', 'alphanumeric', 'Zip') - ); - - $retval = 0; - foreach($attributes as $attributeId => $subData) { - $insertArr = array( - 'attribute_id' => $attributeId, - 'name' => $subData[0], - 'clean_as' => $subData[1], - 'display_name' => $subData[2] - ); - $sql = "INSERT INTO attribute_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for attribute (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($attributes)) { - $sql = "SELECT setval('attribute_table_attribute_id_seq'::text, (SELECT max(attribute_id) FROM attribute_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval = "Successfully created all attributes (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - - return($retval); - }//end create_attributes() - //========================================================================= - - - - //========================================================================= - /** - * Create the anonymous user. This includes their contact data and the - * default group. - * - * TODO: change "short_name" into "display_name". - */ - private function create_anonymous_contact_data() { - $allRecords = array( - 'disabled group' => array( - 'name' => 'group_table', - 'data' => array( - 'group_id' => 0, - 'name' => 'disabled', - 'short_name' => 'DISABLED', - 'leader_uid' => 0 - ), - ), - 'anonymous record in user table' => array( - 'name' => 'user_table', - 'data' => array( - 'uid' => 0, - 'username' => 'Anonymous', - 'password' => 'disabled', //this is PURPOSELY an invalid password (passwords should be 32-char md5's - 'is_admin' => 'f', - 'is_active' => 'f', - 'group_id' => 0, - 'contact_id' => 0 - ), - ), - 'default group' => array( - 'name' => 'group_table', - 'data' => array( - 'group_id' => 1, - 'name' => 'default', - 'short_name' => '-DEFAULT-', - 'leader_uid' => 0 - ), - ), - 'anonymous contact record' => array( - 'name' => 'contact_table', - 'data' => array( - 'contact_id' => 0, - 'company' => '', - 'fname' => 'Anonymous', - 'lname' => '', - 'contact_email_id' => '-1' - ) - ), - 'anonymous email record' => array( - 'name' => 'contact_email_table', - 'data' => array( - 'contact_id' => 0, - 'email' => 'ano...@nu...' - ) - ) - ); - - $retval = 0; - foreach($allRecords as $operationName => $subData) { - $tableName = $subData['name']; - $insertArr = $subData['data']; - - $sql = "INSERT INTO ". $tableName ." ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $this->totalRecords++; - $retval++; - } else { - throw new exception(__METHOD__. ": failed perform operation (". $operationName .") for table (". $tableName .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - $sql = "SELECT currval('contact_email_table_contact_email_id_seq'::text)"; - if($this->run_sql($sql)) { - $data = $this->db->farray(); - $sql = "UPDATE contact_table SET contact_email_id=". $data[0] ." WHERE contact_id=0"; - if($this->run_sql($sql)) { - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to set contact_email_id for anonymous"); - } - } - else { - throw new exception(__METHOD__ .": failed to get sequence for contact_email_table"); - } - - if($retval == count($allRecords)) { - //reset the sequence for the group table... - $sql = "SELECT setval('group_table_group_id_seq'::text, (SELECT max(group_id) FROM group_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created anonymous user, anonymous contact record, and the two default groups (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset group sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (failed sanity check)"); - } - - return($retval); - }//end create_anonymous_contact_data() - //========================================================================= - - - //========================================================================= - private function create_status_records() { - //format: {status_id} => array({name}, {description}) - $statuses = array( - 0 => array('New/Offered', 'New record'), - 1 => array('Pending', 'Not new: pending review, or nearly complete.'), - 2 => array('Running/Accepted', 'Work is underway'), - 3 => array('Stalled', 'Unable to complete, or dependent on other things.'), - 4 => array('Ended/Solved', 'Work is complete!'), - 5 => array('Rejected', 'Denied.'), - 6 => array('Re-opened', 'Was solved, but is once again open.'), - ); - - $retval = 0; - foreach($statuses as $statusId => $subData) { - $insertArr = array( - 'status_id' => $statusId, - 'name' => $subData[0], - 'description' => $subData[1] - ); - $sql = "INSERT INTO status_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to create status (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($statuses)) { - //reset the status_table.status_id sequence... - $sql = "SELECT setval('status_table_status_id_seq'::text, (SELECT max(status_id) FROM status_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created all status records (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset status sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (failed sanity check)"); - } - - return($retval); - - }//end create_status_records() - //========================================================================= - - - - //========================================================================= - private function create_tag_names() { - $tags = array( - 1 => 'bug', - 2 => 'feature request', - 3 => 'information', - 4 => 'network related', - 5 => 'critical', - 6 => 'exception' - ); - - $retval = 0; - foreach($tags as $id=>$name) { - $insertArr = array( - 'tag_name_id' => $id, - 'name' => $name - ); - $sql = "INSERT INTO tag_name_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for (". $name .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($tags)) { - //reset sequence for tag_name_table.tag_name_id - $sql = "SELECT setval('tag_name_table_tag_name_id_seq'::text, (SELECT max(tag_name_id) FROM tag_name_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - //good to go. - $retval = "Successfully created all tags (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset tag_name sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check failed)"); - } - - return($retval); - }//end create_tag_names() - //========================================================================= - - - - //========================================================================= - private function build_preferences() { - //format: {pref_type_id} => array({name}, {default_value}, {display_name}, {description}) - $prefTypes = array( - 1 => array('startModule', 'helpdesk', 'Starting on Module', 'Defines which section will be loaded upon login if nothing was selected.'), - 5 => array('sorting_helpdesk', 'public_id|DESC', 'Helpdesk Sorting', 'Define the type of sorting for the helpdesk page.'), - 6 => array('sorting_project', 'priority|ASC', 'Project Sorting', 'Define the type of sorting for the helpdesk page.'), - 7 => array('projectDetails_taskDisplayOnlyMine', 'all', 'Project Details: Task display', 'Define what tasks are displayed on a project\'s details page.'), - 8 => array('projectDetails_showCompletedIssues', '1', 'Project Details: Display completed issues', 'Should completed issues display in the details of a project?') - ); - - $retval = 0; - foreach($prefTypes as $prefTypeId => $subData) { - $insertArr = array( - 'pref_type_id' => $prefTypeId, - 'name' => $subData[0], - 'default_value' => $subData[1], - 'display_name' => $subData[2], - 'description' => $subData[3] - ); - - $sql = "INSERT INTO pref_type_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == count($prefTypes)) { - //format: {pref_option_id} => array({pref_type_id}, {name}, {effective_value}) - $prefOptions = array( - 1 =>array(1, 'Helpdesk', 'helpdesk'), - 2 =>array(1, 'Projects', 'project'), - 3 =>array(1, 'Summary ', 'summary'), - 8 =>array(5, 'ID - Descending', 'public_id|DESC'), - 9 =>array(5, 'ID - Ascending', 'public_id|ASC'), - 10 =>array(5, 'Priority - Descending', 'priority|DESC'), - 11 =>array(5, 'Priority - Ascending', 'priority|ASC'), - 12 =>array(5, 'Submit - Descending', 'start_date|DESC'), - 13 =>array(5, 'Submit - Ascending', 'start_date|ASC'), - 14 =>array(5, 'Title - Descending', 'name|DESC'), - 15 =>array(5, 'Title - Ascending', 'name|DESC'), - 16 =>array(5, 'Status ID - Descending', 'status_id|DESC'), - 17 =>array(5, 'Status ID - Ascending', 'status_id|DESC'), - 18 =>array(5, 'Assigned - Descending', 'assigned|DESC'), - 19 =>array(5, 'Assigned - Ascending', 'assigned|DESC'), - 20 =>array(6, 'Priority - Ascending', 'priority|ASC'), - 21 =>array(6, 'Priority - Descending', 'priority|DESC'), - 22 =>array(6, 'Name of Project - Ascending', 'name|ASC'), - 23 =>array(6, 'Name of Project - Descending', 'name|DESC'), - 24 =>array(6, 'Begin - Ascending', 'start_date|ASC'), - 25 =>array(6, 'Begin - Descending', 'start_date|DESC'), - 26 =>array(6, 'End - Ascending', 'end|ASC'), - 27 =>array(6, 'End - Descending', 'end|DESC'), - 28 =>array(6, 'Status ID - Ascending', 'status_id|ASC'), - 29 =>array(6, 'Status ID - Descending', 'status_id|DESC'), - 30 =>array(6, 'Progress - Ascending', 'progress|ASC'), - 31 =>array(6, 'Progress - Descending', 'progress|DESC'), - 32 =>array(6, 'Leader - Ascending', 'leader_contact_id|ASC'), - 33 =>array(6, 'Leader - Descending', 'leader_contact_id|DESC'), - 34 =>array(7, 'Show everything', 'all'), - 35 =>array(7, 'All of mine (created & assigned)', 'mine'), - 36 =>array(7, 'Only my assigned items', 'assigned'), - 37 =>array(8, 'Yes', '1'), - 38 =>array(8, 'No', '0'), - ); - - foreach($prefOptions as $prefOptionId => $subData) { - $insertArr = array( - 'pref_option_id' => $prefOptionId, - 'pref_type_id' => $subData[0], - 'name' => $subData[1], - 'effective_value' => $subData[2] - ); - $sql = "INSERT INTO pref_option_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval++; - $this->totalRecords++; - } - else { - throw new exception(__METHOD__ .": failed to insert data for pref option (". $insertArr['name'] .")::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($retval == (count($prefTypes) + count($prefOptions))) { - //reset the pref_type_table.pref_type_id sequence. - $sql = "SELECT setval('pref_type_table_pref_type_id_seq'::text, (SELECT max(pref_type_id) FROM pref_type_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - if($retval == (count($prefTypes) + count($prefOptions))) { - //reset the pref_option_table.pref_option_id sequence. - $sql = "SELECT setval('pref_option_table_pref_option_id_seq'::text, (SELECT max(pref_option_id) FROM pref_option_table))"; - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $retval = "Successfully created all preferences and options (". $retval .")!"; - } - else { - throw new exception(__METHOD__ .": failed to reset the pref_option sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #2 failed)"); - } - } - else { - throw new exception(__METHOD__ .": failed to reset pref_type sequence::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #2 failed): (". $retval ." != ". (count($prefTypes) + count($prefOptions)) .")"); - } - } - else { - throw new exception(__METHOD__ .": internal error (sanity check #1 failed)"); - } - - return($retval); - - }//end build_preferences() - //========================================================================= - - - - //========================================================================= - private function create_users() { - - //retrieve the user information. - $userData = get_setup_data(3, 'post_info'); - if(!is_array($userData) || count($userData) != 2) { - throw new exception(__METHOD__ .": no user data...?". $this->gfObj->debug_print($userData,0)); - } - - $counter = 0; - $retval = "Successfully created records for::: "; - foreach($userData as $num => $subData) { - - //split their name up, based upon spaces. - $nameData = explode(' ', $subData['name']); - $insertArr = array(); - if(count($nameData) == 1) { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = ""; - } - elseif(count($nameData) == 2) { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = $nameData[1]; - } - else { - $insertArr['fname'] = $nameData[0]; - $insertArr['lname'] = preg_replace('/^'. $insertArr['fname'] .' /', '', $subData['name']); - } - $insertArr['contact_email_id'] = '-1'; - - //create their contact record. - $sql = "INSERT INTO contact_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - - if(!strlen($dberror) && $numrows == 1) { - $sql = "SELECT currval('contact_table_contact_id_seq'::text)"; - if($this->run_sql($sql, 1) === TRUE) { - $this->totalRecords++; - - $data = $this->db->farray(); - $contactId = $data[0]; - - //now create the user. - $xUser = $subData['username']; - $insertArr = array( - 'username' => $subData['username'], - 'password' => md5($subData['password'] .'_'. $contactId), - 'is_admin' => interpret_bool($subData['is_admin'], array('f', 't')), - 'contact_id' => $contactId - ); - $sql = "INSERT INTO user_table ". $this->gfObj->string_from_array($insertArr, 'insert', NULL, 'sql'); - - if($this->run_sql($sql, 1) === TRUE) { - $sql = "SELECT currval('user_table_uid_seq'::text)"; - if($this->run_sql($sql,1) === TRUE) { - $data = $this->db->farray(); - $lastUid = $data[0]; - - //create an email address for them. - $sql = "INSERT INTO contact_email_table (contact_id, email) VALUES (". $contactId .", '". strtolower($subData['email']) ."')"; - if($this->run_sql($sql,1) === TRUE) { - $counter++; - //get the newly inserted id, so we can update the contact table. - if($this->run_sql("SELECT currval('contact_email_table_contact_email_id_seq'::text)")) { - $data = $this->db->farray(); - $contactEmailId = $data[0]; - - $sql = "UPDATE contact_table SET contact_email_id=". $contactEmailId ." WHERE contact_id=". $contactId; - if($this->run_sql($sql)) { - $retval = $this->gfObj->create_list($retval, " --- Created record for ". $subData['username'] ." (". $lastUid .")", "<BR>\n"); - } - else { - throw new exception(__METHOD__ .": unable to update contact table with new contact_email_id..."); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve contact_email_id"); - } - } - else { - throw new exception(__METHOD__ .": failed to create email for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to retrieve uid for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to create user record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": unable to retrieve contact_id for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": failed to create contact record for ". $subData['username'] ."::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - - if($counter == 2) { - $retval = $this->gfObj->create_list($retval, " --->>> done, created (". $counter .") records", "<BR>\n"); - } - else { - throw new exception(__METHOD__ .": failed to create users (". $counter .")::: ". $this->gfObj->debug_print($userData,0)); - } - - return($retval); - }//end create_users() - //========================================================================= - - - - //========================================================================= - public function finish(cs_genericPage &$page) { - - $stepRes = get_setup_data(3, 'result'); - if($stepRes == 1) { - $page->set_message_wrapper(array( - 'title' => "Successfully Setup Data", - 'message' => "All default data was stored in the new database successfully!", - 'type' => "status" - )); - store_setup_data(3, $this->data, 'data'); - $page->conditional_header("/setup/4", TRUE); - } - else { - $page->set_message_wrapper(array( - 'title' => "Step Failed", - 'message' => "Please review the errors below and proceed accordingly.", - 'type' => "error" - )); - $page->conditional_header("/setup/3", TRUE); - } - - }//end finish() - //========================================================================= - - - - //========================================================================= - protected function run_sql($sql, $expectedNumrows=NULL) { - if(strlen($sql)) { - $numrows = $this->db->exec($sql); - $dberror = $this->db->errorMsg(); - $this->lastNumrows = $numrows; - $this->lastDberror = $dberror; - - if(!strlen($dberror) && $numrows >= 0) { - if(is_numeric($expectedNumrows)) { - if($expectedNumrows == $numrows) { - $retval = TRUE; - } - else { - $retval = FALSE; - } - } - else { - //don't care if it's numeric. - $retval = TRUE; - } - } - else { - throw new exception(__METHOD__ .": failed to run SQL, got numrows=(". $numrows ."), dberror::: ". $dberror ."<BR>\nSQL::: ". $sql); - } - } - else { - throw new exception(__METHOD__ .": no SQL to run..."); - } - - return($retval); - }//end run_sql() - //========================================================================= - - - - //========================================================================= - private function create_user_group_records() { - $sql = "INSERT INTO user_group_table (uid, group_id) SELECT uid, group_id FROM user_table"; - if($this->run_sql($sql, 3) === TRUE) { - $retval = "Successfully created user_group linkage."; - } - else { - throw new exception(__METHOD__ .": unable to create user group records::: ". $this->lastDberror ."<BR>\nSQL::: ". $sql); - } - return($retval); - }//end create_user_group_records() - //========================================================================= - - -}//end __setupDefaultValues{} - - - -class _setupUpgrade extends upgrade { - - public function __construct(cs_phpDB $db) { - $this->db = $db; - parent::__construct(); - }//end __construct() - - public function finalize_conversion() { - $myVersion = parent::read_version_file(); - $setDataResult = parent::run_sql("SELECT internal_data_set_value('converted_from_version', '". parent::read_version_file() ."')"); - parent::update_num_users_to_convert(); - $retval = parent::update_database_version($myVersion); - debug_print(__METHOD__ .": myVersion=(". $myVersion ."), setDataResult=(". $setDataResult ."), retval=(". $retval .")"); - - return($myVersion); - }//end finalize_conversion() -}//end _setupUpgrade{} - ?> Modified: trunk/1.2/includes/setup/5.inc =================================================================== --- trunk/1.2/includes/setup/5.inc 2008-05-16 03:59:22 UTC (rev 896) +++ trunk/1.2/includes/setup/5.inc 2008-05-20 18:48:23 UTC (rev 897) @@ -6,8 +6,10 @@ if($_POST) { - $obj = new __finalStep($page, $stepNames); - $writeConfigResult = $obj->write_config($page); + #$obj = new __finalStep($page, $stepNames); + #$writeConfigResult = $obj->write_config($page); + $obj = new setup($page); + $writeConfigResult = $obj->handle_step(5, $stepNames); $page->set_message_wrapper(array( 'title' => "Reloaded... ", @@ -37,121 +39,4 @@ } -class __finalStep { - - - private $page; - private $gfObj; - - - //========================================================================= - public function __construct(cs_genericPage $page, array $stepData) { - $this->page = $page; - $this->stepData = $stepData; - unset($this->stepData[5]); - - $this->gfObj = new cs_globalFunctions; - $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) ."/../../". CONFIG_DIRECTORY); - }//end __construct() - //========================================================================= - - - - //========================================================================= - function write_config() { - if($this->fsObj->is_writable(NULL)) { - $lsData = $this->fsObj->ls(); - if(!is_array($lsData[CONFIG_FILENAME])) { - $myData = array(); - foreach($this->stepData as $stepNum=>$garbage) { - $tempStepData = get_setup_data($stepNum, 'data'); - if(is_array($tempStepData)) { - $myData = array_merge($tempStepData, $myData); - } - else { - throw new exception(__METHOD__ .": step #". $stepNum ." has no valid data... ". $this->gfObj->debug_print($tempStepData,0)); - } - } - - //now that we've built the array successfully, now let's turn it into XML. - $xmlCreator = new xmlCreator('config'); - foreach($myData as $index=>$value) { - $xmlCreator->add_tag($index, $value); - } - $extraAttributes = array( - 'generated' => date('Y-m-d H:m:s'), - 'version' => $myData['version_string'] - ); - $xmlCreator->add_attribute('/config', $extraAttributes); - - //now, create an XML string... - $xmlString = $xmlCreator->create_xml_string(); - - $this->fsObj->create_file(CONFIG_FILENAME, TRUE); - $writeRes = $this->fsObj->write($xmlString, CONFIG_FILENAME); - - if($writeRes > 0) { - $retval = "Successfully created the XML config file"; - store_setup_data(5, 1, 'result'); - store_setup_data(5, $retval, 'text'); - } - else { - throw new exception(__METHOD__ .": failed to write any data to the config file"); - } - } - else { - throw new exception(__METHOD__ .": ". CONFIG_FILE_LOCATION ." already exists!"); - } - } - else { - throw new exception(__METHOD__ .": the config directory is not writable!"); - } - - $configObj = new config(CONFIG_FILE_LOCATION); - $configObj->remove_setup_config(); - - return($retval); - }//end write_config() - //========================================================================= -} - - -//####################################################################################### -/** - * Built to avoid always printing-out the results (so we can retrieve result data separately. - */ -class MyDisplay extends SimpleReporter { - - function paintHeader($test_name) { - } - - function paintFooter($test_name) { - } - - function paintStart($test_name, $size) { - parent::paintStart($test_name, $size); - } - - function paintEnd($test_name, $size) { - parent::paintEnd($test_name, $size); - } - - function paintPass($message) { - parent::paintPass($message); - } - - function paintFail($message) { - parent::paintFail($message); - } -} -//####################################################################################### - - -class unitTest extends UnitTestCase { - - function testOfTester () { - $this->assertTrue(FALSE); - } -} - ?> Added: trunk/1.2/lib/setup.class.php =================================================================== --- trunk/1.2/lib/setup.class.php (rev 0) +++ trunk/1.2/lib/setup.class.php 2008-05-20 18:48:23 UTC (rev 897) @@ -0,0 +1,1627 @@ +<?php +/* + * SVN INFORMATION::: + * ------------------ + * SVN Signature::::::: $Id$ + * Last Author::::::::: $Author$ + * Current Revision:::: $Revision$ + * Repository Location: $HeadURL$ + * Last Updated:::::::: $Date$ + */ + + +require_once(dirname(__FILE__) .'/../lib/simpletest/unit_tester.php'); +require_once(dirname(__FILE__) .'/../lib/simpletest/reporter.php'); + + +class setup { + + private $pageObj; + private $dbObj; + + //============================================================================= + function __construct(cs_genericPage $page, cs_phpDB $db=NULL) { + $this->pageObj = $page; + $this->dbObj = $db; + }//end __construct() + //============================================================================= + + + + //============================================================================= + function store_setup_data($step, $data, $type='data') { + $_SESSION['setup'][$type][$step] = $data; + }//end store_setup_data() + //============================================================================= + + + + //============================================================================= + function get_setup_data($step, $type='data') { + return($_SESSION['setup'][$type][$step]); + }//end get_setup_data() + //============================================================================= + + + + //============================================================================= + function read_version_file() { + $retval = NULL; + $fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/..'); + + //okay, all files present: check the version in the VERSION file. + $lines = $fsObj->read('VERSION', TRUE); + $versionLine = $lines[2]; + if(preg_match('/^VERSION: /', $versionLine)) { + + $retval = trim(preg_replace('/VERSION: /', '', $versionLine)); + } + else { + throw new exception(__METHOD__ .": could not find VERSION data"); + } + + return($retval); + }//end read_version_file() + //============================================================================= + + + + //============================================================================= + function get_db_params() { + + $stepOneData = get_setup_data(1, 'data'); + if(is_array($stepOneData)) { + $params = array(); + foreach($stepOneData as $name=>$value) { + $index = preg_replace('/^database__/', '', $name); + $params[$index] = $value; + } + } + else { + throw new exception(__FUNCTION__ .": unable to retrieve step one data..."); + } + + return($params); + }//end get_db_params() + //============================================================================= + + + + //============================================================================= + function reset_all_steps($leaveText=TRUE, $afterStep=NULL) { + $retval=0; + if(is_array($_SESSION['setup'])) { + if(is_numeric($afterStep)) { + $_SESSION['setup']['lastStep'] = $afterStep; + } + else { + $_SESSION['setup']['lastStep'] = 1; + } + $unsetThis = array('data', 'result', 'accessible'); + + if($leaveText !== TRUE) { + $unsetThis[] = 'text'; + } + foreach($unsetThis as $indexName) { + if(isset($_SESSION['setup'][$indexName])) { + if(is_numeric($afterStep)) { + foreach($_SESSION['setup'][$indexName] as $stepNum=>$stepData) { + if(is_numeric($stepNum) && $stepNum > $afterStep) { + unset($_SESSION['setup'][$indexName][$stepNum]); + $retval++; + } + } + } + else { + unset($_SESSION['setup'][$indexName]); + $retval++; + } + } + } + } + else { + throw new exception(__FUNCTION__ .": no step data found in session"); + } + + return($retval); + }//end reset_all_steps() + //============================================================================= + + + + //============================================================================= + function test_db_stuff(cs_phpDB &$db=NULL) { + if(is_null($db) || !is_object($db)) { + $db = new cs_phpDB; + } + $stepOneData = get_setup_data(1); + $params = get_db_params(); + $originalParams = $params; + + + + $params['dbname'] = 'template1'; + $retval = "Failed to connect to ". $params['host'] .":". $params['dbname'] ." (host connection failed)"; + + $gf = new cs_globalFunctions; + + try { + $db->connect($params); + $result = "Connected successfully to ". $params['host'] .":". $params['dbname'] ." (host connection good)"; + try { + $newParams = $originalParams; + $db2 = new cs_phpDB; + $db2->connect($originalParams ); + $retval = "Connected successfully to ". $newParams['host'] .":". $newParams['dbname'] ." (host connection good, DATABASE EXISTS)"; + } + catch(exception $e) { + //no database! + //TODO: do a preg_match() on $e->getMessage() to see if it says something about the database not existing + $retval = TRUE; + } + } + catch(exception $e) { + $retval = $e->getMessage(); + } + + return($retval); + }//end test_db_stuff() + //============================================================================= + + + + //============================================================================= + public function handle_step($step, $extraData=NULL) { + if(is_null($step) || !is_numeric($step)) { + throw new exception(__METHOD__ .": invalid step (". $step .")"); + } + else { + switch($step) { + + //------------------------------------------------------------- + case 1: { + $obj = new __tmpSetupClass($this->dbObj, $this->pageObj); + $retval = $obj->go(); + break; + }//end case 1 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + case 3: { + $obj = new __setupDefaultValues(); + $retval = $obj->go(); + break; + }//end case 3 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + case 5: { + $obj = new __finalStep($this->pageObj, $extraData); + $retval = $obj->write_config($this->pageObj); + break; + }//end case 5 + //------------------------------------------------------------- + + + //------------------------------------------------------------- + default: { + throw new exception(__METHOD__ .": invalid step (". $step .")"); + }//end case default + //------------------------------------------------------------- + } + } + + return($retval); + }//end handle_step() + //============================================================================= + + +}//end setup{} + + + + +/* ###################################################################### + * ###################################################################### + * ###################################################################### + * + * HELPER CLASSES + * (eventually, they should probably be consolidated into setup{}... or separated into other files...?) + * + * ###################################################################### + * ###################################################################### + * ###################################################################### + */ + + + + + + + + + + + + + +class __tmpSetupClass { + + + private $db; + private $fs; + private $page; + private $url = "/setup/1"; + + //========================================================================= + public function __construct(cs_phpDB &$db, cs_genericPage &$page) { + $this->db = $db; + $this->fsObj = new cs_fileSystemClass(dirname(__FILE__) .'/../../docs/sql/setup'); + $this->gfObj = new cs_globalFunctions; + $this->page = $page; + + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Initializing...', 'text'); + }//end __construct() + //========================================================================= + + + //========================================================================= + public function go() { + $retval = "Nothing done... something went horribly wrong."; + if($this->create_database()) { + $retval = $this->handle_plpgsql(); + + if($retval === TRUE) { + $retval = $this->load_schema(); + if($retval === TRUE) { + $this->page->set_message_wrapper( + array( + 'title' => "Step Successful", + 'message' => "Finished step two with result:::<BR>\n". get_setup_data(2,'text'), + 'type' => "status" + ) + ); + $this->page->conditional_header('/setup/3', TRUE); + } + else { + $retval = "There was an error while testing PL/PGSQL functionality: ". $retval; + store_setup_data(2, $retval, 'text'); + } + } + } + else { + store_setup_data(2, 0, 'result'); + store_setup_data(2, 'Failed to create database', 'text'); + $setupData = get_setup_data(1, 'data'); + $retval = "Unable to create database... check that ". $setupData['host'] . + " does not already have a database named '". $setupData['dbname'] ."'. " . + "Also, make sure no other user is connected to template1."; + } + + return($retval); + }//end go() + //========================================================================= + + + + //========================================================================= + private function create_database() { + $params = get_db_params(); + + //okay, let's try to create the database. + $numrows = $this->db->exec("CREATE DATABASE ". $params['dbname'] ." WITH ENCODING='SQL_ASCII'"); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $retval = FALSE; + } + else { + $retval = TRUE; + + //okay. Now destroy our database handle & create a new one, connected to the proper database. + unset($this->db); + $this->db = new cs_phpDb; + $this->db->connect(get_db_params()); + } + + return($retval); + }//end create_database() + //========================================================================= + + + //========================================================================= + private function load_schema() { + + store_setup_data(2, "Schema not loaded... ", 'text'); + store_setup_data(2, 0, 'result'); + + $fileData = $this->fsObj->read("01__storedprocs.sql"); + + //now we'll try to push that into the database. + $this->db->beginTrans(); + + $this->gfObj->debug_print("Loading stored procedures... "); + + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + //keep going + $retval = "Successfully loaded stored procedures! Loading tables...."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("02__tables.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "Done loading tables!!! Creating indexes and miscellaneous other things..."; + $this->gfObj->debug_print($retval); + + $fileData = $this->fsObj->read("03__indexes_etc.sql"); + $this->db->exec($fileData); + $dberror = $this->db->errorMsg(); + + if(strlen($dberror)) { + $this->db->rollbackTrans(); + $retval = $dberror; + } + else { + $retval = "All stored proc... [truncated message content] |
From: <cra...@us...> - 2008-05-16 03:59:25
|
Revision: 896 http://cs-project.svn.sourceforge.net/cs-project/?rev=896&view=rev Author: crazedsanity Date: 2008-05-15 20:59:22 -0700 (Thu, 15 May 2008) Log Message: ----------- *** RELEASE 1.2.0-ALPHA7 *** AFFECTS ISSUES::: #159: Notices: remove Created/Updated/Solved prefixes #143: Multiple group to user associations #188: Multiple inline scripted upgrades fail...??? Modified Paths: -------------- trunk/1.2/VERSION Modified: trunk/1.2/VERSION =================================================================== --- trunk/1.2/VERSION 2008-05-16 03:55:37 UTC (rev 895) +++ trunk/1.2/VERSION 2008-05-16 03:59:22 UTC (rev 896) @@ -1,4 +1,4 @@ $Id:VERSION 628 2007-11-20 16:58:45Z crazedsanity $ -VERSION: 1.2.0-ALPHA6 +VERSION: 1.2.0-ALPHA7 $HeadURL:https://cs-project.svn.sourceforge.net/svnroot/cs-project/trunk/VERSION $ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-16 03:55:46
|
Revision: 895 http://cs-project.svn.sourceforge.net/cs-project/?rev=895&view=rev Author: crazedsanity Date: 2008-05-15 20:55:37 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix for issue #159 (Notices: remove Created/Updated/Solved prefixes). The notices should now be in a standard format, so mail clients that thread conversations should do so properly. Modified Paths: -------------- trunk/1.2/lib/helpdeskClass.php Modified: trunk/1.2/lib/helpdeskClass.php =================================================================== --- trunk/1.2/lib/helpdeskClass.php 2008-05-16 03:26:15 UTC (rev 894) +++ trunk/1.2/lib/helpdeskClass.php 2008-05-16 03:55:37 UTC (rev 895) @@ -348,12 +348,12 @@ $emailAddressList = $linkObj->get_record_email_list($newRecord); if((strlen($_SESSION['login_email'])) && ($_SESSION['login_email'] != $parseArr['email'])) { - $subject = "Helpdesk Issue #$retval Created [for ".$parseArr['email'] ."] -- ". $parseArr['name']; + $subject = "Helpdesk Issue #$retval [for ".$parseArr['email'] ."] -- ". $parseArr['name']; send_email($emailAddressList, $subject, $emailTemplate, $parseArr); $normalEmailExtra = " [registered by ". $_SESSION['login_loginname'] .": uid=". $_SESSION['login_id'] ."]"; } else { - $subject = "Helpdesk Issue #$retval Created -- ". $parseArr['name']; + $subject = "Helpdesk Issue #$retval -- ". $parseArr['name']; send_email($emailAddressList, $subject, $emailTemplate, $parseArr); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-16 03:26:41
|
Revision: 894 http://cs-project.svn.sourceforge.net/cs-project/?rev=894&view=rev Author: crazedsanity Date: 2008-05-15 20:26:15 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix issue #188 (revert invalid fix for cs-phpxml problem; see issue #189). Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php trunk/1.2/upgrade/upgrade.xml Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-05-13 00:21:44 UTC (rev 893) +++ trunk/1.2/lib/upgradeClass.php 2008-05-16 03:26:15 UTC (rev 894) @@ -178,20 +178,6 @@ $config = $xmlParser->get_tree(TRUE); $this->config = $config['UPGRADE']; - - //now fix the "MATCHING" section as needed. - $matchingKeys = $this->config['MATCHING']; - - $myMatching = $this->config['MATCHING']; - unset($this->config['MATCHING']); - if(!preg_match('/^V/', $matchingKeys[0])) { - foreach($myMatching as $index=>$data) { - $keys = array_keys($data); - $this->config['MATCHING'][$keys[0]] = $myMatching[$index][$keys[0]]; - } - } - debug_print($this->config); - }//end read_upgrade_config_file() //========================================================================= @@ -286,8 +272,7 @@ //========================================================================= public function parse_version_string($versionString) { - if(is_null($versionString) || !(strlen($versionString) > 4)) { - cs_debug_backtrace(1); + if(is_null($versionString) || !strlen($versionString)) { throw new exception(__METHOD__ .": invalid version string ($versionString)"); } $tmp = explode('.', $versionString); @@ -337,16 +322,6 @@ $retval['version_suffix'] = ""; } - //double-check our data matches the initial version string. - $checkThis = $retval['version_major'] .".". $retval['version_minor'] .".". $retval['version_maintenance']; - if(strlen($retval['version_suffix'])) { - $checkThis .= "-". $retval['version_suffix']; - } - - if($checkThis != $versionString) { - throw new exception(__METHOD__ .": initial version string (". $versionString .") doesn't match final (". $checkThis .")"); - } - return($retval); }//end parse_version_string() //========================================================================= @@ -743,7 +718,7 @@ } else { //TODO: should there maybe be an option to throw an exception (freak out) here? - debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $versionNumber .")",1); + debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $version .")",1); } } else { @@ -839,10 +814,6 @@ $dbVersion = $this->databaseVersion; $newVersion = $this->versionFileVersion; - if((strlen($dbVersion) <= 4) || (strlen($newVersion) <= 4)) { - throw new exception(__METHOD__ .": invalid data in dbVersion (". $dbVersion .") or newVersion (". $newVersion .")"); - } - $retval = array(); if(!$this->is_higher_version($dbVersion, $newVersion)) { throw new exception(__METHOD__ .": version (". $newVersion .") isn't higher than (". $dbVersion .")... something is broken"); Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-05-13 00:21:44 UTC (rev 893) +++ trunk/1.2/upgrade/upgrade.xml 2008-05-16 03:26:15 UTC (rev 894) @@ -25,8 +25,6 @@ <class_name>upgrade_to_1_2_0_ALPHA4</class_name> <call_method>run_upgrade</call_method> </v1.2.0-ALPHA3> - </matching> - <matching> <v1.2.0-ALPHA6> <target_version>1.2.0-ALPHA7</target_version> <script_name>upgradeTo1.2.0-ALPHA7.php</script_name> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-13 00:21:49
|
Revision: 893 http://cs-project.svn.sourceforge.net/cs-project/?rev=893&view=rev Author: crazedsanity Date: 2008-05-12 17:21:44 -0700 (Mon, 12 May 2008) Log Message: ----------- Fixes for critical issue #188. /lib/upgradeClass.php: * read_upgrade_config_file(): -- if there are multiple entries beneath "MATCHING", and the first index doesn't start with "V", assume it is numerically indexed, and the index beneath the number is the actual version we're looking for. * parse_version_string(): -- if either version is less than or equal to 4 characters, it throws an exception (because "x.x.x" is the smallest length valid version string). -- check that putting the parsed data back together from the array is identical to the given version number. * is_higher_version(): -- better debug_print() data. * get_upgrade_list(): -- check to ensure $dbVersion and $newVersion both appear to contain valid version information. Modified Paths: -------------- trunk/1.2/lib/upgradeClass.php Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-05-12 22:35:11 UTC (rev 892) +++ trunk/1.2/lib/upgradeClass.php 2008-05-13 00:21:44 UTC (rev 893) @@ -178,6 +178,20 @@ $config = $xmlParser->get_tree(TRUE); $this->config = $config['UPGRADE']; + + //now fix the "MATCHING" section as needed. + $matchingKeys = $this->config['MATCHING']; + + $myMatching = $this->config['MATCHING']; + unset($this->config['MATCHING']); + if(!preg_match('/^V/', $matchingKeys[0])) { + foreach($myMatching as $index=>$data) { + $keys = array_keys($data); + $this->config['MATCHING'][$keys[0]] = $myMatching[$index][$keys[0]]; + } + } + debug_print($this->config); + }//end read_upgrade_config_file() //========================================================================= @@ -272,7 +286,8 @@ //========================================================================= public function parse_version_string($versionString) { - if(is_null($versionString) || !strlen($versionString)) { + if(is_null($versionString) || !(strlen($versionString) > 4)) { + cs_debug_backtrace(1); throw new exception(__METHOD__ .": invalid version string ($versionString)"); } $tmp = explode('.', $versionString); @@ -322,6 +337,16 @@ $retval['version_suffix'] = ""; } + //double-check our data matches the initial version string. + $checkThis = $retval['version_major'] .".". $retval['version_minor'] .".". $retval['version_maintenance']; + if(strlen($retval['version_suffix'])) { + $checkThis .= "-". $retval['version_suffix']; + } + + if($checkThis != $versionString) { + throw new exception(__METHOD__ .": initial version string (". $versionString .") doesn't match final (". $checkThis .")"); + } + return($retval); }//end parse_version_string() //========================================================================= @@ -718,7 +743,7 @@ } else { //TODO: should there maybe be an option to throw an exception (freak out) here? - debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $version .")",1); + debug_print(__METHOD__ .": while checking ". $index .", realized the new version (". $checkIfHigher .") is LOWER than current (". $versionNumber .")",1); } } else { @@ -814,6 +839,10 @@ $dbVersion = $this->databaseVersion; $newVersion = $this->versionFileVersion; + if((strlen($dbVersion) <= 4) || (strlen($newVersion) <= 4)) { + throw new exception(__METHOD__ .": invalid data in dbVersion (". $dbVersion .") or newVersion (". $newVersion .")"); + } + $retval = array(); if(!$this->is_higher_version($dbVersion, $newVersion)) { throw new exception(__METHOD__ .": version (". $newVersion .") isn't higher than (". $dbVersion .")... something is broken"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cra...@us...> - 2008-05-12 22:35:17
|
Revision: 892 http://cs-project.svn.sourceforge.net/cs-project/?rev=892&view=rev Author: crazedsanity Date: 2008-05-12 15:35:11 -0700 (Mon, 12 May 2008) Log Message: ----------- Fix issue #143. Modified Paths: -------------- trunk/1.2/upgrade/upgrade.xml Added Paths: ----------- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php Added: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql =================================================================== --- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql (rev 0) +++ trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql 2008-05-12 22:35:11 UTC (rev 892) @@ -0,0 +1,11 @@ +-- +-- SVN INFORMATION::: +-- +-- SVN Signature::::::::: $Id$ +-- Last Committted Date:: $Date$ +-- Last Committed Path::: $HeadURL$ +-- + + +delete from user_group_table WHERE user_group_id NOT IN (select distinct ON (uid, group_id) user_group_id FROM user_group_table); +CREATE UNIQUE INDEX user_group_table_uid_group_id_uidx ON user_group_table USING btree (uid, group_id); \ No newline at end of file Property changes on: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql ___________________________________________________________________ Name: svn:keywords + Id HeadURL Date Revision Author Name: svn:eol-style + native Modified: trunk/1.2/upgrade/upgrade.xml =================================================================== --- trunk/1.2/upgrade/upgrade.xml 2008-05-12 22:18:42 UTC (rev 891) +++ trunk/1.2/upgrade/upgrade.xml 2008-05-12 22:35:11 UTC (rev 892) @@ -26,4 +26,12 @@ <call_method>run_upgrade</call_method> </v1.2.0-ALPHA3> </matching> + <matching> + <v1.2.0-ALPHA6> + <target_version>1.2.0-ALPHA7</target_version> + <script_name>upgradeTo1.2.0-ALPHA7.php</script_name> + <class_name>upgrade_to_1_2_0_ALPHA7</class_name> + <call_method>run_upgrade</call_method> + </v1.2.0-ALPHA6> + </matching> </upgrade> Copied: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php (from rev 888, trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php) =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php (rev 0) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA7.php 2008-05-12 22:35:11 UTC (rev 892) @@ -0,0 +1,54 @@ +<?php + +class upgrade_to_1_2_0_ALPHA7 extends dbAbstract { + + private $logsObj; + + //========================================================================= + public function __construct(cs_phpDB &$db) { + if(!$db->is_connected()) { + throw new exception(__METHOD__ .": database is not connected"); + } + $this->db = $db; + + $this->logsObj = new logsClass($this->db, 'Upgrade'); + + $this->gfObj = new cs_globalFunctions; + $this->gfObj->debugPrintOpt = 1; + }//end __construct() + //========================================================================= + + + + //========================================================================= + public function run_upgrade() { + + $this->db->beginTrans(__METHOD__); + + + $this->run_schema_changes(); + + + $this->db->commitTrans(__METHOD__); + + return('Upgrade complete'); + }//end run_upgrade() + //========================================================================= + + + + //========================================================================= + private function run_schema_changes() { + + $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); + $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA7.sql'); + + $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". + base64_encode($this->fsObj->read($this->lastSQLFile)); + $this->logsObj->log_by_class($details, 'system'); + + }//end run_schema_changes() + //========================================================================= +} + +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |