Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv21548
Modified Files:
uc_packages.php
Log Message:
class redefined in uc_repository.php
Index: uc_packages.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_packages.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** uc_packages.php 5 Aug 2002 08:32:01 -0000 1.2
--- uc_packages.php 13 Nov 2002 09:20:01 -0000 1.3
***************
*** 2,7 ****
include_once("lib/Tar.php");
! class UcPackage
{
var $name;
--- 2,11 ----
include_once("lib/Tar.php");
+ include_once("lib/uc_sql.php");
! define("CATEGORY", 1);
! define("PACKAGE", 2);
!
! class UcPackage1
{
var $name;
***************
*** 9,28 ****
var $description;
var $home;
- var $ucurl;
var $tarball;
var $status;
var $setup;
! function install($destDir)
{
! global $ucConfig;
! $ar = parse_url($this->tarball);
! $tbname = basename($ar["path"]);
! $from_fd = fopen($this->tarball, "rb");
! $to_fd = fopen($destDir . "/" . $tbname, "wb");
$buffer = '';
!
while ($buffer = fread($from_fd, 1024))
{
--- 13,45 ----
var $description;
var $home;
var $tarball;
var $status;
var $setup;
+ var $db;
+
+ var $dlOk;
+ var $unpackOk;
! function UcPackage()
{
! $cfg = $GLOBALS["ucConfig"];
! $this->setupDir = $cfg->modulesRoot . "/" . $this->name
! . "/upcase/";
!
! $this->db = new UcSql();
! $this->dlOk = false;
! $this->unpackOk = false;
! }
!
! function download()
! {
! $cfg = $GLOBALS["ucConfig"];
! $src = $GLOBALS["packagesSource"];
! $from_fd = fopen($src . "/" . $this->tarball, "rb");
! $to_fd = fopen($cfg->modulesRoot . "/" . $this->tarball, "wb");
$buffer = '';
!
while ($buffer = fread($from_fd, 1024))
{
***************
*** 30,53 ****
flush();
if ($res < 1024)
- {
break;
- }
}
-
fclose($from_fd);
fclose($to_fd);
!
if ($res > -1)
{
! flush();
! $tar = new Archive_Tar($destDir . "/" . $tbname, true);
! $tar->extract($destDir);
! symlink($destDir . "/" . basename($tbname, ".tar.gz"),
! $destDir . "/" . $this->name);
}
! $setupPage = $ucConfig->wwwRoot . "/modules/" . $this->name
! . "/" . $this->setup;
! header("Location: $setupPage");
}
}
--- 47,131 ----
flush();
if ($res < 1024)
break;
}
fclose($from_fd);
fclose($to_fd);
!
if ($res > -1)
+ $this->dlOk = true;
+ }
+
+ function unpack()
+ {
+ $cfg = $GLOBALS["ucConfig"];
+ if (!$this->dlOk)
+ return;
+ $arch = $cfg->modulesRoot . "/" . $this->tarball;
+ print("<br><b>" . $arch . "</b><br>");
+ $tar = new Archive_Tar($arch, true);
+ $tar->extract($cfg->modulesRoot) or die("Unable to unpack archive");
+ symlink($cfg->modulesRoot . "/" . basename($this->tarball, ".tar.gz"),
+ $cfg->modulesRoot . "/" . $this->name);
+ $this->unpackOk = true;
+ }
+
+ function install()
+ {
+ $cfg = $GLOBALS["ucConfig"];
+
+ if (empty($this->setup))
{
! include_once($cfg->modulesRoot . "/" . $this->name
! . "/" . "/upcase/setup.php");
! pkg_install($cfg, $this);
! $this->mysqlSetup();
! }
! else
! {
! $setupPage = $ucConfig->wwwModules . "/" . $this->name
! . "/" . $this->setup;
! header("Location: $setupPage");
}
+ }
+
+ function mysqlSetup()
+ {
+ $cfg = $GLOBALS["ucConfig"];
+ $script = $cfg->modulesRoot . "/" . $this->name
+ . "/" . "/upcase/mysql-setup.php";
+ $tblprefix = $this->name . "_";
+ $proceed = include($script);
! if ($proceed)
! {
! foreach ($tables_create as $query)
! $this->db->Execute($query)
! or die("Error in install script, " . $this->db->ErrorMsg());
!
! foreach ($tables_insert as $query)
! $this->db->Execute($query)
! or die("Error in install script, " . $this->db->ErrorMsg());
!
! foreach ($tables_misc as $query)
! $this->db->Execute($query)
! or die("Error in install script, " . $this->db->ErrorMsg());
! }
! }
!
! function addAccounts()
! {
! global $ucConfig;
! global $ucsql_allusers;
!
! $query = $ucsql_allusers;
!
! include_once($ucConfig->modulesRoot . "/" . $this->name
! . "/upcase/accounts.php");
!
! $db = new UcSql();
! $res = $db->Execute($query) or die("Unable to get users: "
! . $db->ErrorMsg());
! while ($o = $res->FetchNextObject(true))
! addUser($ucConfig, $this, $o);
}
}
***************
*** 105,109 ****
}
! function get_package($name, $version)
{
$this->parse();
--- 183,187 ----
}
! function getPackage($name, $version)
{
$this->parse();
|