diff options
author | Steve Dibb <beandog@gentoo.org> | 2010-02-20 15:10:31 +0000 |
---|---|---|
committer | Steve Dibb <beandog@gentoo.org> | 2010-02-20 15:10:31 +0000 |
commit | cc2a6584e489b736560104fd9d0a9091895a6779 (patch) | |
tree | 66d08674797f59c2eac1be16d102dea3866b0fae | |
parent | Update recent_changes (diff) | |
download | znurt-org-backend-cc2a6584e489b736560104fd9d0a9091895a6779.tar.gz znurt-org-backend-cc2a6584e489b736560104fd9d0a9091895a6779.tar.bz2 znurt-org-backend-cc2a6584e489b736560104fd9d0a9091895a6779.zip |
Track import status in DB
git-svn-id: file:///var/svn/portage@92 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r-- | import.all.php | 7 | ||||
-rw-r--r-- | import.final.php | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/import.all.php b/import.all.php index 73b95f8..39c296c 100644 --- a/import.all.php +++ b/import.all.php @@ -24,6 +24,10 @@ $db->query($sql); } + $sql = "INSERT INTO import_status (status) VALUES ('start');"; + $db->query($sql); + $import_id = $db->lastInsertID(); + // FIXME these could be accidentally overwritten in one of the includes $base = true; $packages = true; @@ -51,6 +55,9 @@ file_put_contents("/tmp/znurt/status", "$file\n"); } + $sql = "UPDATE import_status SET status = ".$db->quote($file).", udate = NOW() WHERE id = ".$db->quote($import_id).";"; + $db->query($sql); + include "import.$file.php"; } } diff --git a/import.final.php b/import.final.php index c2cf5da..eca6253 100644 --- a/import.final.php +++ b/import.final.php @@ -81,4 +81,10 @@ print_r($hits); } + // Update status + if($import_id) { + $sql = "UPDATE import_status SET status = 'finish', udate = NOW() WHERE id = ".$db->quote($import_id).";"; + $db->query($sql); + } + ?>
\ No newline at end of file |