GithubHelp home page GithubHelp logo

Comments (3)

SydneyUni-Jim avatar SydneyUni-Jim commented on September 18, 2024

convert in PKP\cliTool\traits\ConvertLogFile initially set $isSuccessful to false and only sets it to true once it has successfully converted an entry.

$isSuccessful = false;
while (!feof($fhandle)) {

$isSuccessful = true;
}

This logic fails if:

  • the file's size is zero and feof(…) immediately returns false; or
  • the while loop never gets to its end because all of the lines trigger one of the continue statements

from pkp-lib.

SydneyUni-Jim avatar SydneyUni-Jim commented on September 18, 2024

Relate to handling of $isSuccessful, after the first successful entry sets $isSuccessful to true it is never set back to false. This means the I8508_ConvertCurrentLogFile migration passes if and whenever at least one log entry is successfully converted.

The logics like this don't set $isSuccessful back to false.

if (!$this->isLogEntryValid($entryData)) {
fwrite(STDERR, "Invalid log entry at line {$lineNumber}." . PHP_EOL);
continue;
}

from pkp-lib.

bozana avatar bozana commented on September 18, 2024

Hi @SydneyUni-Jim,
Yes, I think we need to somehow consider -- at least report it correctly -- if the file is empty (also in case only continue statements are called).
But, else, if any other problem occurs (like invalid line) I think it is OK: we convert the lines that can be converted and report the existing issues, so that user can act as needed.

from pkp-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.