UPDATED : Installer
This commit is contained in:
parent
ced46355bd
commit
c755d4990f
13 changed files with 1341 additions and 119 deletions
|
@ -463,8 +463,8 @@ class ClipBucket
|
|||
{
|
||||
$feeds = 5;
|
||||
$text = 400;
|
||||
//$url = 'http://blog.clip-bucket.com/feed/';
|
||||
$url = 'http://localhost/clipbucket/2.x/2/upload/tester/feed.xml';
|
||||
$url = 'http://blog.clip-bucket.com/feed/';
|
||||
//$url = 'http://localhost/clipbucket/2.x/2/upload/tester/feed.xml';
|
||||
$news = xml2array($url);
|
||||
if(!$news)
|
||||
{
|
||||
|
|
|
@ -3397,8 +3397,8 @@
|
|||
*/
|
||||
function get_latest_cb_info()
|
||||
{
|
||||
//$url = 'http://clip-bucket.com/versions.xml';
|
||||
$url = 'http://localhost/clipbucket/2.x/2/upload/tester/versions.xml';
|
||||
$url = 'http://clip-bucket.com/versions.xml';
|
||||
//$url = 'http://localhost/clipbucket/2.x/2/upload/tester/versions.xml';
|
||||
$version = xml2array($url);
|
||||
if(!$version)
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
936
upload/install/cb_v2_2.0.1.sql
Normal file
936
upload/install/cb_v2_2.0.1.sql
Normal file
File diff suppressed because one or more lines are too long
|
@ -124,4 +124,37 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function the_version()
|
||||
{
|
||||
$thefile = '../includes/clipbucket.php';
|
||||
if(file_exists('../includes/clipbucket.php'))
|
||||
{
|
||||
$file = file_get_contents($thefile);
|
||||
//Get Version
|
||||
preg_match("/define\(\"VERSION\",\"(.*)\"\)/",$file,$matches);
|
||||
$version = $matches[1];
|
||||
return $version;
|
||||
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to check weather current ClipBucket is updateable or not
|
||||
*/
|
||||
function update_able()
|
||||
{
|
||||
$thefile = '../includes/clipbucket.php';
|
||||
if(file_exists('../includes/clipbucket.php'))
|
||||
{
|
||||
$version = the_version();
|
||||
if(VERSION > $version)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}else
|
||||
return false;
|
||||
}
|
||||
?>
|
|
@ -5,11 +5,10 @@
|
|||
*/
|
||||
|
||||
include("../includes/functions.php");
|
||||
include("./clipbucket.php");
|
||||
|
||||
define("installer","ClipBucket v2 Installer");
|
||||
|
||||
define("installer","ClipBucket v2 Installer");
|
||||
define("VERSION","2");
|
||||
define("STATE","pre-alpha");
|
||||
define("RELEASED","12-25-2009");
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
|
||||
error_reporting(E_ALL ^E_NOTICE ^E_DEPRECATED);
|
||||
include("../includes/clipbucket.php");
|
||||
include("config.php");
|
||||
include("checkup.php");
|
||||
|
||||
|
@ -40,8 +39,13 @@ if(file_exists(SCRIPT_DIR.'/files/install.loc'))
|
|||
|
||||
switch($step)
|
||||
{
|
||||
case 1:
|
||||
case "0":
|
||||
default:
|
||||
{
|
||||
$step = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
$step = 1;
|
||||
}
|
||||
|
@ -97,11 +101,6 @@ switch($step)
|
|||
$errors[] = '"/includes" directory is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/includes" directory is writeable';
|
||||
//Checking includes Directory
|
||||
if(!is_writeable("../includes/clipbucket.php") && file_exists("../includes/clipbucket.php"))
|
||||
$errors[] = '"/includes" directory is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/includes/clipbucket.php" directory is writeable';
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
@ -203,9 +202,11 @@ switch($step)
|
|||
$db->update("config",array("value"),array(SCRIPT_DIR)," name='basedir'");
|
||||
|
||||
copy("install.loc",SCRIPT_DIR.'/files/install.loc');
|
||||
copy("clipbucket.php",SCRIPT_DIR."/includes/clipbucket.php");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -213,6 +214,74 @@ switch($step)
|
|||
{
|
||||
$step = 'ai';
|
||||
}
|
||||
|
||||
break;
|
||||
case "update_0":
|
||||
{
|
||||
$step = 'update_0';
|
||||
if(file_exists("./../includes/dbconnect.php"))
|
||||
{
|
||||
include("./../includes/dbconnect.php");
|
||||
$msgs[] = "Connected to database";
|
||||
}else
|
||||
{
|
||||
$errors[] = "Unable to connect to find dbconnect.php :(, Please check your ./includes/dbconnect.php";
|
||||
}
|
||||
|
||||
//Checking Files Permissions
|
||||
if(!is_files_writeable())
|
||||
$errors[] = '"/files" directory is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/files" directory is writeable';
|
||||
|
||||
//Checking install Directory
|
||||
if(!is_writeable("../install"))
|
||||
$errors[] = '"/install" directory is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/install" directory is writeable';
|
||||
|
||||
//Checking includes Directory
|
||||
if(!is_writeable("../includes"))
|
||||
$errors[] = '"/includes" directory is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/includes" directory is writeable';
|
||||
|
||||
//Checking includes Directory
|
||||
if(!is_writeable("../includes/clipbucket.php"))
|
||||
$errors[] = '"/includes/clipbucket.php" file is not writeable - Please changes its permission to 0777';
|
||||
else
|
||||
$msgs[] = '"/includes/clipbucket.php" file is writeable';
|
||||
}
|
||||
break;
|
||||
case "update_1":
|
||||
{
|
||||
include("./../includes/dbconnect.php");
|
||||
$step = 'update_1';
|
||||
//Checking for the update file
|
||||
$dbfile = "cb_v".the_version()."_".VERSION.".sql";
|
||||
$lines = file($dbfile);
|
||||
foreach ($lines as $line_num => $line)
|
||||
{
|
||||
if (substr($line, 0, 2) != '--' && $line != '')
|
||||
{
|
||||
$templine .= $line;
|
||||
if (substr(trim($line), -1, 1) == ';')
|
||||
{
|
||||
$db->Execute($templine);
|
||||
$templine = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->update("config",array("value"),array(RELEASED)," name='date_released'");
|
||||
$db->update("config",array("value"),array(now())," name='date_updated'");
|
||||
|
||||
copy("install.loc",SCRIPT_DIR.'/files/install.loc');
|
||||
unlink(SCRIPT_DIR."/includes/clipbucket.php");
|
||||
copy("clipbucket.php",SCRIPT_DIR."/includes/clipbucket.php");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include("steps/body.php");
|
||||
|
|
19
upload/install/js/jquery.js
vendored
Normal file
19
upload/install/js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,7 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>ClipBucket v2 Installer</title>
|
||||
<link href="./theme/blue.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="./js/jquery.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
26
upload/install/steps/step_0.php
Normal file
26
upload/install/steps/step_0.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<div class="content">
|
||||
<h2>Please select your installation method</h2>
|
||||
</div>
|
||||
|
||||
<div class="footer" align="right">
|
||||
|
||||
<form name="form1" method="post" action="">
|
||||
<input type="submit" name="step0" id="step0" value="Upgrade From 1.x" class="button_disabled" onClick="return false;">
|
||||
<input type="hidden" name="step" value="1" id="step" >
|
||||
<?php
|
||||
if(!update_able())
|
||||
{
|
||||
?>
|
||||
<input type="submit" name="step0" id="step0" value="Update From 2.x" class="button_disabled" onClick="return false;">
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<input type="submit" name="step0" id="step0" value="Update From 2.x" class="button" onClick="$('#step').val('update_0');this.submit()">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="submit" name="step0" id="step0" value="Fresh Installation" class="button">
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
|
@ -1,6 +1,13 @@
|
|||
<form name="form2" method="post" action="" class="install_form"><div class="content">
|
||||
<h2>Database Settings</h2>
|
||||
<?php include("msgs.php") ?>
|
||||
<?php include("msgs.php");
|
||||
|
||||
if(count($msgs)==0)
|
||||
{
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<label for="host">Host</label>
|
||||
<input name="host" type="text" id="host" value="<? if($_POST['host']) echo form_val(post('host')); else echo "localhost"?>">
|
||||
<label for="dbname">Database Name</label>
|
||||
|
@ -10,6 +17,19 @@
|
|||
<label for="dbpass">Database Password</label>
|
||||
<input type="text" name="dbpass" id="dbpass" value="<? if($_POST['dbpass']) echo form_val(post('dbpass'));?>">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}else
|
||||
{
|
||||
?>
|
||||
|
||||
<input name="host" type="hidden" id="host" value="<? if($_POST['host']) echo form_val(post('host')); else echo "localhost"?>">
|
||||
<input type="hidden" name="dbname" id="dbname" value="<? if($_POST['dbname']) echo form_val(post('dbname'));?>">
|
||||
<input type="hidden" name="dbuser" id="dbuser" value="<? if($_POST['dbuser']) echo form_val(post('dbuser'));?>">
|
||||
<input type="hidden" name="dbpass" id="dbpass" value="<? if($_POST['dbpass']) echo form_val(post('dbpass'));?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="footer" align="right">
|
||||
|
|
28
upload/install/steps/step_update_0.php
Normal file
28
upload/install/steps/step_update_0.php
Normal file
|
@ -0,0 +1,28 @@
|
|||
<div class="content"><h2>Update ClipBucket from <?=the_version()?> to <?=VERSION?></h2>
|
||||
<?php include("msgs.php") ?>
|
||||
</div>
|
||||
<div class="footer" align="right">
|
||||
|
||||
<form name="form1" method="post" action="">
|
||||
|
||||
<?php
|
||||
if(count($errors)>0)
|
||||
{
|
||||
?>
|
||||
<input type="hidden" name="step" value="update_0" id="step" >
|
||||
<input type="submit" name="step0" id="step0" value="Recheck" class="button" >
|
||||
<input type="submit" name="step0" id="step0" value="Continue Update" class="button_disabled" onClick="return false;">
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<input type="hidden" name="step" value="update_1" id="step" >
|
||||
<input type="submit" name="step0" id="step0" value="Recheck" class="button_disabled" onClick="return false;">
|
||||
<input type="submit" name="step0" id="step0" value="Continue Update" class="button">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
9
upload/install/steps/step_update_1.php
Normal file
9
upload/install/steps/step_update_1.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div class="content"><h2>ClipBucket Has been updated to <?=VERSION?></h2>
|
||||
|
||||
<h3>ClipBucket has been successfully updated to the <?=VERSION?>, <a href="<?=SCRIPT_URL.'/admin_area'?>">click here to access admin panel</a></h3>
|
||||
|
||||
</div>
|
||||
<div class="footer" align="right">
|
||||
|
||||
|
||||
</div>
|
Loading…
Add table
Reference in a new issue