-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHRAS-4085_data-volumes-api #4529
Conversation
…default '' (=octets, same as 'o')
round sizes to 2 decimals
6d3d657
to
db021b6
Compare
add command bin/maintenance lazaret:set_sizes
$row = $stmt->fetch(PDO::FETCH_ASSOC); | ||
$stmt->closeCursor(); | ||
|
||
$disksize = ceil($row['size'] / $blocksize) * $blocksize;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO...
disksize is per file, eg. if blocksize=16ko, the disksize of every file is a multiple of 16ko :
- 10 small files (1 ko) = 10 * 16 ko ==> 160 ko (good)
here we get 10 * 1 ko = 10 ko ==> 16 ko (wrong)
Do blocksize, divider etc in sql, like in other requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
$this | ||
->setDescription('Set the null size in the LazaretFiles table') | ||
->addOption('dry-run', null, InputOption::VALUE_NONE, 'dry run, count') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better use --dry like in recent commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
/** @var LazaretFile $lazaretNullSize */ | ||
foreach ($lazaretNullSizes as $lazaretNullSize) { | ||
$lazaretFileName = $path .'/'.$lazaretNullSize->getFilename(); | ||
$media = $this->container->getMediaFromUri($lazaretFileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap in a try/catch just in case of missing file, and set size to 0 in case of error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Changelog
Adds
/api/v3/monitor/data/?oauth_token=xxx&blocksize=16ko&unit=mo&details=1
blocksize
is a number with possible units : '', 'o', 'octet', 'octets', 'Ko', 'Mo', 'Go' ; default: "" (same as 1 o) ==> disksize=size;unit
sets the unit of size resultsdetails=1
to also get subdefs by collection/namee.g.:
bin/maintenance lazaret:set_sizes
to fill the null size column of the LazaretFiles