Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / tests [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
12 Aug 2002 17:51:06postnuke_official/testsimport8.php,1.14,1.15Mike
 import article comments

Update of /home/cvsroot/postnuke_official/tests
In directory ns7.hostnuke.net:/tmp/cvs-serv29294

Modified Files:
	import8.php 
Log Message:
import article comments


Index: import8.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/tests/import8.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** import8.php	11 Aug 2002 14:58:47 -0000	1.14
--- import8.php	12 Aug 2002 17:51:04 -0000	1.15
***************
*** 94,97 ****
--- 94,100 ----
          die("Unable to load the articles admin API");
      }
+     if (!pnModAPILoad('comments','admin')) {
+         die("Unable to load the comments admin API");
+     }
  
      if (!isset($reset)) {
***************
*** 134,139 ****
      while (!$result->EOF) {
          list($uid,$name,$uname,$email,$pass,$url) = $result->fields;
! //        $insert = 'INSERT INTO ' . $pntable['users'] . '
!         $insert = 'INSERT DELAYED INTO ' . $pntable['users'] . '
                       (pn_uid, pn_name, pn_uname, pn_email, pn_pass, pn_url,
                       pn_auth_module)
--- 137,142 ----
      while (!$result->EOF) {
          list($uid,$name,$uname,$email,$pass,$url) = $result->fields;
! //        $insert = 'INSERT DELAYED INTO ' . $pntable['users'] . '
!         $insert = 'INSERT INTO ' . $pntable['users'] . '
                       (pn_uid, pn_name, pn_uname, pn_email, pn_pass, pn_url,
                       pn_auth_module)
***************
*** 371,375 ****
      }
      $result->Close();
!     echo "<strong>TODO : add comments etc.</strong><br><br>\n";
      echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;';
      if ($count > $numitems && $startnum + $numitems < $count) {
--- 374,378 ----
      }
      $result->Close();
!     //echo "<strong>TODO : add comments etc.</strong><br><br>\n";
      echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;';
      if ($count > $numitems && $startnum + $numitems < $count) {
***************
*** 462,466 ****
      }
      $result->Close();
!     echo "<strong>TODO : add comments etc.</strong><br><br>\n";
      echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;';
      if ($count > $numitems && $startnum + $numitems < $count) {
--- 465,469 ----
      }
      $result->Close();
!     //echo "<strong>TODO : add comments etc.</strong><br><br>\n";
      echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;';
      if ($count > $numitems && $startnum + $numitems < $count) {
***************
*** 682,686 ****
      $result->Close();
      echo "<strong>TODO : do something with FAQ display</strong><br><br>\n";
- // the end - for now...
      echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;
            <a href="import8.php?step=' . ($step+1) . '">Go to step ' . ($step+1) . '</a><br>';
--- 685,688 ----
***************
*** 688,692 ****
  
      if ($step == 9) {
!     echo "<strong>9. Optimizing database tables</strong><br>\n";
      $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['users']);
      if ($dbconn->ErrorNo() != 0) {
--- 690,767 ----
  
      if ($step == 9) {
!     $regid = pnModGetIDFromName('articles');
!     echo "<strong>9. Importing comments</strong><br>\n";
!     $query = 'SELECT COUNT(*) FROM ' . $oldprefix . '_comments';
!     $result = $dbconn->Execute($query);
!     if ($dbconn->ErrorNo() != 0) {
!         die("Oops, count comments failed : " . $dbconn->ErrorMsg());
!     }
!     $count = $result->fields[0];
!     $result->Close();
!     $query = 'SELECT pn_tid, pn_sid, pn_pid, pn_date, pn_uname, pn_uid,
!               pn_host_name, pn_subject, pn_comment 
!               FROM ' . $oldprefix . '_comments 
!               LEFT JOIN ' . $oldprefix . '_users
!               ON ' . $oldprefix . '_users.pn_uname = ' . $oldprefix . '_comments.pn_name
!               ORDER BY pn_tid ASC';
!     $numitems = 2000;
!     if (!isset($startnum)) {
!         $startnum = 0;
!     }
!     if ($count > $numitems) {
!         $result = $dbconn->SelectLimit($query, $numitems, $startnum);
!     } else {
!         $result = $dbconn->Execute($query);
!     }
!     if ($dbconn->ErrorNo() != 0) {
!         die("Oops, select comments failed : " . $dbconn->ErrorMsg());
!     }
!     if ($reset && $startnum == 0) {
!         $dbconn->Execute("DELETE FROM " . $pntable['comments']);
!     }
!     $num = 1;
!     include_once('modules/comments/backend/backend.php');
!     while (!$result->EOF) {
!         list($tid,$sid,$pid,$date,$uname,$uid,$hostname,$subject,$comment) = $result->fields;
! 
!         if (empty($uid)) {
!             $uid = 0;
!         }
!         $data['modid'] = $regid;
!         $data['itemid'] = $sid;
!         $data['pid'] = $pid;
!         $data['author'] = $uid;
!         $data['title'] = pnVarPrepForStore($subject);
!         $data['comment'] = pnVarPrepForStore($comment);
!         $data['hostname'] = pnVarPrepForStore($hostname);
!         $data['cid'] = $tid;
!         $data['date'] = $date;
! 
!         if (!pnComments_Add($data)) {
!             echo "Failed inserting comment ($sid $pid) $uname - $subject<br>\n";
!         } elseif ($count < 200) {
!             echo "Inserted comment ($sid $pid) $uname - $subject<br>\n";
!         } elseif ($num % 100 == 0) {
!             echo "Inserted comment " . ($num + $startnum) . "<br>\n";
!             flush();
!         }
!         $num++;
!         $result->MoveNext();
!     }
!     $result->Close();
!     echo "<strong>TODO : import other comments</strong><br><br>\n";
!     echo '<a href="import8.php">Return to start</a>&nbsp;&nbsp;&nbsp;';
!     if ($count > $numitems && $startnum + $numitems < $count) {
!         $startnum += $numitems;
!         echo '<a href="import8.php?step=' . $step . '&startnum=' . $startnum . '">Go to step ' . $step . ' - comments ' . $startnum . '+ of ' . $count . '</a><br>';
!     } else {
!         echo '<a href="import8.php?step=' . ($step+1) . '">Go to step ' . ($step+1) . '</a><br>';
!     }
!     }
! 
! // TODO: add the rest :-)
! 
!     if ($step == 10) {
!     echo "<strong>10. Optimizing database tables</strong><br>\n";
      $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['users']);
      if ($dbconn->ErrorNo() != 0) {
***************
*** 699,702 ****
--- 774,778 ----
          $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['hitcount']);
      }
+     $dbconn->Execute('OPTIMIZE TABLE ' . $pntable['comments']);
  
      echo "<strong>TODO : import the rest...</strong><br><br>\n";


Directory filter : [ all ] / postnuke_official / tests [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3