MadJeff
07.04.2004, 00:00
I'm working on a script to import e107 and PN downloads db into my ReMOSitory downloads DB, and am running into an issue. Here's the script I hacked to import the categories from one to another:
<?
define( "_VALID_MOS", 1 );
include_once( "globals.php" );
require_once( "configuration.php" );
require_once( "classes/mambo.php" );
require_once( "components/com_remository/remository.html.php" );
include_once ('language/'.$mosConfig_lang.'.php');
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'root';
$pnconfig['dbpass'] = '';
$pnconfig['dbname'] = 'madjeff_forum';
$pnconfig['prefix'] = 'e107_';
$pndatabase = new database( $pnconfig['dbhost'], $pnconfig['dbuname'], $pnconfig['dbpass'], $pnconfig['dbname'], $pnconfig['prefix'] );
$pndatabase->setQuery ("SELECT download_category_name, download_category_description FROM ".$pnconfig['prefix']."download_category");
$subfolders = $pndatabase->loadObjectList();
$database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
$acl = new gacl_api();
$success = 0;
$failure = 0;
foreach ($subfolders as $subfolder){
$subfolder = new HTML_downloads( $database );
$subfolder->name = $folder->download_category_name;
$subfolder->published = 1;
$subfolder->description = $folder->download_category_description;
$subfolder->files = 1;
$subfolder->icon = generic_open.gif;
$subfolder->registered = 0;
if(!$subfolder->check()){
echo "Failed checking details for story $folder->name.<br/>Error details: ".$subfolder->getError()."<br/>";
$failure++;
}else{
if(!$subfolder->store()){
echo "Failed storing details for story $folder->name.<br/>Error details: ".$subfolder->getError()."<br/>";
$failure++;
}else{
$success++;
}
}
unset($subfolder);
}
echo "<p>Succesful transfers: $success</p>";
echo "<p>Failed transfers: $failure</p>";
?>
When I run this, I get the following error:
Fatal error: Call to undefined function: check() in W:\www\Mambo45\e1072mosdcat.php on line 61
Line 61 is this line:
if(!$subfolder->check()){
I used the remository.html.php as an include thinking all the stuff I need is in there, but something's not right. Gayle or anyone, what am I missing?
This is a good learning experience for me, but I know this is some minor thing I'm missing... :D
<?
define( "_VALID_MOS", 1 );
include_once( "globals.php" );
require_once( "configuration.php" );
require_once( "classes/mambo.php" );
require_once( "components/com_remository/remository.html.php" );
include_once ('language/'.$mosConfig_lang.'.php');
$pnconfig['dbhost'] = 'localhost';
$pnconfig['dbuname'] = 'root';
$pnconfig['dbpass'] = '';
$pnconfig['dbname'] = 'madjeff_forum';
$pnconfig['prefix'] = 'e107_';
$pndatabase = new database( $pnconfig['dbhost'], $pnconfig['dbuname'], $pnconfig['dbpass'], $pnconfig['dbname'], $pnconfig['prefix'] );
$pndatabase->setQuery ("SELECT download_category_name, download_category_description FROM ".$pnconfig['prefix']."download_category");
$subfolders = $pndatabase->loadObjectList();
$database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
$acl = new gacl_api();
$success = 0;
$failure = 0;
foreach ($subfolders as $subfolder){
$subfolder = new HTML_downloads( $database );
$subfolder->name = $folder->download_category_name;
$subfolder->published = 1;
$subfolder->description = $folder->download_category_description;
$subfolder->files = 1;
$subfolder->icon = generic_open.gif;
$subfolder->registered = 0;
if(!$subfolder->check()){
echo "Failed checking details for story $folder->name.<br/>Error details: ".$subfolder->getError()."<br/>";
$failure++;
}else{
if(!$subfolder->store()){
echo "Failed storing details for story $folder->name.<br/>Error details: ".$subfolder->getError()."<br/>";
$failure++;
}else{
$success++;
}
}
unset($subfolder);
}
echo "<p>Succesful transfers: $success</p>";
echo "<p>Failed transfers: $failure</p>";
?>
When I run this, I get the following error:
Fatal error: Call to undefined function: check() in W:\www\Mambo45\e1072mosdcat.php on line 61
Line 61 is this line:
if(!$subfolder->check()){
I used the remository.html.php as an include thinking all the stuff I need is in there, but something's not right. Gayle or anyone, what am I missing?
This is a good learning experience for me, but I know this is some minor thing I'm missing... :D