Misc updates
Prettify some SQL code. Add some error-reponse code for fatal failed SQL statements.
This commit is contained in:
parent
edf2dc338c
commit
382511077a
|
@ -123,7 +123,10 @@ if (!in_array($_DDATA['tbprefix'].'config', $_DDATA['tables'], true)) {
|
|||
`jw_hostname` TINYTEXT NOT NULL,
|
||||
`jw_compression` TINYINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`version`)
|
||||
) ENGINE = MyISAM, CHARACTER SET = utf8mb4, COLLATE = utf8mb4_unicode_520_ci;'
|
||||
) ENGINE = MyISAM,
|
||||
CHARACTER SET = utf8mb4,
|
||||
COLLATE = utf8mb4_unicode_520_ci
|
||||
;'
|
||||
);
|
||||
$err = $create->errorInfo();
|
||||
if ($err[0] != '00000')
|
||||
|
@ -232,7 +235,10 @@ if (!in_array($_DDATA['tbprefix'].'crawldata', $_DDATA['tables'], true)) {
|
|||
`last_modified` INT NOT NULL,
|
||||
`priority` DECIMAL(2,1) NOT NULL,
|
||||
UNIQUE `content_checksum` (`content_checksum`)
|
||||
) ENGINE = MyISAM, CHARACTER SET = utf8mb4, COLLATE = utf8mb4_unicode_520_ci;'
|
||||
) ENGINE = MyISAM,
|
||||
CHARACTER SET = utf8mb4,
|
||||
COLLATE = utf8mb4_unicode_520_ci
|
||||
;'
|
||||
);
|
||||
$err = $create->errorInfo();
|
||||
if ($err[0] != '00000')
|
||||
|
@ -248,7 +254,10 @@ if (!in_array($_DDATA['tbprefix'].'query', $_DDATA['tables'], true)) {
|
|||
`stamp` INT UNSIGNED NOT NULL,
|
||||
`ip` INT UNSIGNED NOT NULL,
|
||||
`cache` MEDIUMBLOB NOT NULL
|
||||
) ENGINE = MyISAM, CHARACTER SET = utf8mb4, COLLATE = utf8mb4_unicode_520_ci;'
|
||||
) ENGINE = MyISAM,
|
||||
CHARACTER SET = utf8mb4,
|
||||
COLLATE = utf8mb4_unicode_520_ci
|
||||
;'
|
||||
);
|
||||
$err = $create->errorInfo();
|
||||
if ($err[0] != '00000')
|
||||
|
|
|
@ -806,7 +806,7 @@ if (in_array($_DDATA['tbprefix'].'crawltemp', $_DDATA['tables'], true)) {
|
|||
// Run through every entry in the crawltemp table
|
||||
foreach ($select as $row) {
|
||||
|
||||
// In an entry matches an existing URL in the queue (just
|
||||
// If an entry matches an existing URL in the queue (just
|
||||
// starting URLs right now) then delete that queue entry
|
||||
foreach ($_RDATA['sp_queue'] as $key => $queue)
|
||||
if ($row['url'] == $queue[0])
|
||||
|
@ -852,6 +852,13 @@ if (in_array($_DDATA['tbprefix'].'crawltemp', $_DDATA['tables'], true)) {
|
|||
$drop = $_DDATA['pdo']->query(
|
||||
'DROP TABLE IF EXISTS `'.$_DDATA['tbprefix'].'crawltemp`;'
|
||||
);
|
||||
$err = $drop->errorInfo();
|
||||
if ($err[0] != '00000') {
|
||||
// If we couldn't delete the interrupted crawldata table, this is
|
||||
// a fatal error
|
||||
OS_crawlLog('Could not delete previously interrupted crawl data; unable to crawl.', 2);
|
||||
throw new Exception('Could not delete previously interrupted crawl data; unable to crawl.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -860,7 +867,13 @@ $create = $_DDATA['pdo']->query(
|
|||
'CREATE TABLE IF NOT EXISTS`'.$_DDATA['tbprefix'].'crawltemp`
|
||||
LIKE `'.$_DDATA['tbprefix'].'crawldata`;'
|
||||
);
|
||||
|
||||
$err = $create->errorInfo();
|
||||
if ($err[0] != '00000') {
|
||||
// If we could not create the crawldata table, or an interrupted
|
||||
// crawldata table doesn't exist, then this is a fatal error
|
||||
OS_crawlLog('Unable to create or reuse existing crawl data table; unable to crawl.', 2);
|
||||
throw new Exception('Unable to create or reuse existing crawl data table; unable to crawl.');
|
||||
}
|
||||
|
||||
// Prepare SQL statements
|
||||
$selectData = $_DDATA['pdo']->prepare(
|
||||
|
|
Loading…
Reference in a new issue