Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions pinc/post_files.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ function generate_post_files(
}

$pages_res = page_info_query($project->projectid, $limit_round_id, $which_text);
if ($pages_res === false) {
throw new Exception("Could not get $limit_round_id text for $project->projectid");
}

// Join all the page texts into a plain text file...
$plain_path = "{$pathbase}.txt";
Expand Down Expand Up @@ -93,9 +90,6 @@ function generate_interim_file(
}

$pages_res = page_info_query($project->projectid, $limit_round_id, $which_text);
if ($pages_res === false) {
return;
}

// join the page texts together
$filedata = join_proofed_text($pages_res, $include_proofers, null);
Expand Down Expand Up @@ -183,7 +177,7 @@ function join_page_texts(mysqli_result $pages_res): string

// -----------------------------------------------------------------------------
/** @param ?resource $fp */
function join_proofed_text(mysqli_result|false $pages_res, bool $include_proofers, $fp): string
function join_proofed_text(mysqli_result $pages_res, bool $include_proofers, $fp): string
{
// Join the round 2 page-texts of the given project,
// and write the result to file-object $fp.
Expand Down Expand Up @@ -227,7 +221,7 @@ function join_proofed_text(mysqli_result|false $pages_res, bool $include_proofer

// -----------------------------------------------------------------------------

function page_info_query(string $projectid, string $limit_round_id, string $which_text): mysqli_result|false
function page_info_query(string $projectid, string $limit_round_id, string $which_text): mysqli_result
{
if ($limit_round_id == '[OCR]') { // somewhat kludgey
// doesn't matter what $which_text is.
Expand Down Expand Up @@ -294,6 +288,11 @@ function page_info_query(string $projectid, string $limit_round_id, string $whic
ORDER BY image
");

if (!$res) {
throw new Exception("Could not get $limit_round_id text for $projectid");
}

/** @var mysqli_result $res -- mysqli_query("SELECT") never returns true */
return $res;
}

Expand Down
6 changes: 1 addition & 5 deletions pinc/project_quick_check.inc
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function _test_project_for_credited_source(string $projectid): PQCResult
return new PQCResult($test_name, $test_desc, $status, $summary, $details);
}

function _test_project_for_bad_bytes(string $projectid): ?PQCResult
function _test_project_for_bad_bytes(string $projectid): PQCResult
{
global $code_url;

Expand All @@ -481,10 +481,6 @@ function _test_project_for_bad_bytes(string $projectid): ?PQCResult
}

$pages_res = page_info_query($projectid, 'F2', 'LE');
if ($pages_res === false) {
echo "!page_info_query returned FALSE!\n";
return null;
}

$page_details_url = "$code_url/tools/project_manager/page_detail.php?project=$projectid";
$details_for_this_project = "
Expand Down