forked from extern/egroupware
working on new setup prog that will allow add-on apps to take advantage of it
This commit is contained in:
parent
b6e9eb701e
commit
66ab743445
3
calendar/setup/create_tables.inc.php
Normal file
3
calendar/setup/create_tables.inc.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "<br>hellow world<br>";
|
||||
?>
|
17
calendar/setup/droptables.inc.php
Normal file
17
calendar/setup/droptables.inc.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Setup *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or");at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$db->query("DROP TABLE calendar_entry");
|
||||
$db->query("DROP TABLE calendar_entry_repeats");
|
||||
$db->query("DROP TABLE calendar_entry_user");
|
||||
?>
|
53
calendar/setup/newtables.inc.php
Normal file
53
calendar/setup/newtables.inc.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Setup *
|
||||
* http://www.phpgroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// NOTE: Please use spaces to seperate the field names. It makes copy and pasting easier.
|
||||
|
||||
$sql = "CREATE TABLE calendar_entry (
|
||||
cal_id int(11) DEFAULT '0' NOT NULL auto_increment,
|
||||
cal_owner int(11) DEFAULT '0' NOT NULL,
|
||||
cal_group varchar(255),
|
||||
cal_datetime int(11),
|
||||
cal_mdatetime int(11),
|
||||
cal_edatetime int(11),
|
||||
cal_priority int(11) DEFAULT '2' NOT NULL,
|
||||
cal_type varchar(10),
|
||||
cal_access varchar(10),
|
||||
cal_name varchar(80) NOT NULL,
|
||||
cal_description text,
|
||||
PRIMARY KEY (cal_id)
|
||||
)";
|
||||
$db->query($sql);
|
||||
|
||||
$sql = "CREATE TABLE calendar_entry_repeats (
|
||||
cal_id int(11) DEFAULT '0' NOT NULL,
|
||||
cal_type enum('daily','weekly','monthlyByDay','monthlyByDate','yearly') DEFAULT 'daily' NOT NULL,
|
||||
cal_use_end int DEFAULT '0',
|
||||
cal_end int(11),
|
||||
cal_frequency int(11) DEFAULT '1',
|
||||
cal_days char(7)
|
||||
)";
|
||||
$db->query($sql);
|
||||
|
||||
$sql = "CREATE TABLE calendar_entry_user (
|
||||
cal_id int(11) DEFAULT '0' NOT NULL,
|
||||
cal_login int(11) DEFAULT '0' NOT NULL,
|
||||
cal_status char(1) DEFAULT 'A',
|
||||
PRIMARY KEY (cal_id, cal_login)
|
||||
)";
|
||||
$db->query($sql);
|
||||
|
||||
$currentver = "0.9.8pre5";
|
||||
$oldversion = $currentver;
|
||||
update_app_version("calendar");
|
||||
?>
|
@ -21,6 +21,8 @@
|
||||
$phpgw_info["server"]["version"] = "Undetected";
|
||||
}
|
||||
|
||||
$phpgw_info["server"]["app_images"] = "templates/default/images";
|
||||
|
||||
function show_header($title = "",$nologoutbutton = False)
|
||||
{
|
||||
global $phpgw_info, $PHP_SELF;
|
||||
@ -155,7 +157,6 @@
|
||||
$db->Database = $phpgw_domain[$SetupDomain]["db_name"];
|
||||
$db->User = $phpgw_domain[$SetupDomain]["db_user"];
|
||||
$db->Password = $phpgw_domain[$SetupDomain]["db_pass"];
|
||||
|
||||
}
|
||||
|
||||
function check_db()
|
||||
@ -209,6 +210,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
function app_setups($appname = ""){
|
||||
global $phpgw_info;
|
||||
$d = dir($phpgw_info["server"]["server_root"]);
|
||||
while($entry=$d->read()) {
|
||||
if (is_dir ($phpgw_info["server"]["server_root"]."/".$entry."/setup")){
|
||||
echo $entry."<br>\n";
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
|
||||
function execute_script($script, $appname = ""){
|
||||
global $phpgw_info, $currentver, $oldversion, $phpgw_domain, $db;
|
||||
if ($appname == ""){
|
||||
$d = dir($phpgw_info["server"]["server_root"]);
|
||||
while($entry=$d->read()) {
|
||||
$f = $phpgw_info["server"]["server_root"]."/".$entry."/setup/".$script.".inc.php";
|
||||
if (file_exists ($f)){include($f);}
|
||||
}
|
||||
$d->close();
|
||||
}else{
|
||||
$f = $phpgw_info["server"]["server_root"]."/".$appname."/setup/".$script.".inc.php";
|
||||
if (file_exists ($f)){include($f);}
|
||||
}
|
||||
}
|
||||
|
||||
function update_app_version($appname, $tableschanged = True){
|
||||
global $currentver, $phpgw_info, $db, $tablechanges;
|
||||
if ($tableschanged == True){$tablechanges = True;}
|
||||
$db->query("update applications set app_version='".$currentver."' where app_name='".$appname."'");
|
||||
}
|
||||
|
||||
function manage_tables(){
|
||||
global $currentver, $tablechanges, $phpgw_domain, $phpgw_info, $db;
|
||||
if ($currentver == "drop"){
|
||||
execute_script("droptables");
|
||||
}
|
||||
if ($currentver == "new") {
|
||||
execute_script("newtables");
|
||||
execute_script("common_default_records");
|
||||
execute_script("lang");
|
||||
}
|
||||
|
||||
if ($currentver == "oldversion") {
|
||||
$currentver = $oldversion;
|
||||
execute_script("upgradetables");
|
||||
}
|
||||
|
||||
/* Not yet implemented
|
||||
if (!$tablechanges == True){
|
||||
echo " <tr bgcolor=\"e6e6e6\">\n";
|
||||
echo " <td>No table changes were needed. The script only updated your version setting.</td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function setup_header($title = "",$nologoutbutton = False) {
|
||||
global $phpgw_info, $PHP_SELF, $dontshowtheheaderagain;
|
||||
|
||||
|
@ -81,23 +81,25 @@
|
||||
Stage 5.2 =
|
||||
*/
|
||||
|
||||
$phpgw_info["server"]["app_images"] = "templates/default/images";
|
||||
|
||||
echo '<table border="1" width="100%" cellspacing="0" cellpadding="2">';
|
||||
echo ' <tr><td align="left" WIDTH="20%" bgcolor="486591"><font color="fefefe">Step 1 - header.inc.php</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage == 1.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>You have not created your header.inc.php yet.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td><form action="./createheader.php" method=post>You have not created your header.inc.php yet.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 1.2) {
|
||||
echo '<tr><td align="center">O</td><td><form action="./createheader.php" method=post>Your header.inc.php is out of date. Please upgrade it.<br> <input type=submit value="Upgrade now"></form></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td><form action="./createheader.php" method=post>Your header.inc.php is out of date. Please upgrade it.<br> <input type=submit value="Upgrade now"></form></td></tr>';
|
||||
}elseif ($stage >= 1.3) {
|
||||
echo '<tr><td align="center">X</td><td><form action="./createheader.php" method=post>
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/completed.gif" alt="X" border="0"></td><td><form action="./createheader.php" method=post>
|
||||
Your header.inc.php is in place and current.<br> <input type=submit value="Edit existing header.inc.php"></form></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 2 - database management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 2.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 2.1) {
|
||||
echo '<tr><td align="center">O</td><td><form action="index.php" method=post>Your database does not exist.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td><form action="index.php" method=post>Your database does not exist.<br> <input type=submit value="Create one now"></form></td></tr>';
|
||||
}elseif ($stage == 2.2) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>';
|
||||
echo '
|
||||
You appear to be running a pre-beta version of phpGroupWare<br>
|
||||
We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.<br>
|
||||
@ -121,8 +123,8 @@
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 2.3) {
|
||||
/* commented out because I cannot accuratly figure out if the DB exists */
|
||||
//echo '<tr><td align="center">O</td><td><form action="index.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
|
||||
echo '<tr><td align="center">O</td><td>Make sure that your database is created and the account permissions are set.<br>';
|
||||
//echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td><form action="index.php" method=post>Your database exist, would you like to create your tables now?<br> <input type=submit value="Create tables"></form></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Make sure that your database is created and the account permissions are set.<br>';
|
||||
if ($phpgw_domain[$SetupDomain]["db_type"] == "mysql"){
|
||||
echo "
|
||||
<br>Instructions for creating the database in MySQL:<br>
|
||||
@ -145,7 +147,7 @@
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo 'Once the database is setup correctly <br><input type=submit name="action" value="Create"> the tables</form></td></tr>';
|
||||
}elseif ($stage == 2.4) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>';
|
||||
echo "You appear to be running version $oldversion of phpGroupWare.<br>\n";
|
||||
echo "We will automaticly update your tables/records to ".$phpgw_info["server"]["version"].", but we highly recommend backing up your tables in case the script causes damage to your data.\n";
|
||||
echo "These automated scripts can easily destroy your data. Please backup before going any further!\n";
|
||||
@ -160,7 +162,7 @@
|
||||
echo "</form>\n";
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 2.5) {
|
||||
echo '<tr><td align="center">O</td><td>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>';
|
||||
echo "<table width=\"100%\">\n";
|
||||
echo " <tr bgcolor=\"486591\"><td><font color=\"fefefe\"> <b>$subtitle</b></font></td></tr>\n";
|
||||
echo " <tr bgcolor=\"e6e6e6\"><td>$submsg</td></tr>\n";
|
||||
@ -176,7 +178,7 @@
|
||||
echo '</form>';
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage >= 2.6) {
|
||||
echo '<tr><td align="center">X</td><td>Your tables are current.';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/completed.gif" alt="X" border="0"></td><td>Your tables are current.';
|
||||
echo "<form method=\"POST\" action=\"index.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"oldversion\" value=\"new\">\n";
|
||||
echo "<br>Insanity: <input type=\"submit\" name=\"action\" value=\"Delete all my tables and data\">\n";
|
||||
@ -185,31 +187,31 @@
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 3 - Configuration</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 3.1) {
|
||||
echo '<tr><td align="center">O</td><td>Please phpGroupWare for your environment.';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Please phpGroupWare for your environment.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Configure Now\"></form>";
|
||||
echo '</td></tr>';
|
||||
}elseif ($stage == 3.2) {
|
||||
echo '<tr><td align="center">X</td><td>Configuration completed.';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/completed.gif" alt="X" border="0"></td><td>Configuration completed.';
|
||||
echo "<form method=\"POST\" action=\"config.php\"><input type=\"submit\" value=\"Edit Current Configuration\"></form>";
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 4 - language management</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 4.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.1.<br></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>stage 4.1.<br></td></tr>';
|
||||
}elseif ($stage == 4.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 4.2.<br></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>stage 4.2.<br></td></tr>';
|
||||
}
|
||||
echo ' <tr><td align="left" bgcolor="486591"><font color="fefefe">Step 5 - Add-on Application Installation</td><td align="right" bgcolor="486591"> </td></tr>';
|
||||
if ($stage < 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>Not ready for this stage yet.</td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>Not ready for this stage yet.</td></tr>';
|
||||
}elseif ($stage == 5.1) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.1.<br></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>stage 5.1.<br></td></tr>';
|
||||
}elseif ($stage == 5.2) {
|
||||
echo '<tr><td align="center">O</td><td>stage 5.2.<br></td></tr>';
|
||||
echo '<tr><td align="center"><img src="'.$phpgw_info["server"]["app_images"].'/incomplete.gif" alt="O" border="0"></td><td>stage 5.2.<br></td></tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
13
setup/test.php
Normal file
13
setup/test.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True);
|
||||
include("../header.inc.php");
|
||||
include("./inc/functions.inc.php");
|
||||
|
||||
$SetupDomain = "phpgroupware.org";
|
||||
loaddb();
|
||||
// $currentver = "drop";
|
||||
$currentver = "new";
|
||||
manage_tables();
|
||||
|
||||
execute_script("create_tables");
|
||||
?>
|
Loading…
Reference in New Issue
Block a user