Report generated on May-27 11:00 pm
Pier last restarted: Fri May 24 02:20:01 UTC 2024
A-OK - Image file is newer (2024-05-27T18:06:03+00:00)
(PRScheduledTaskExamples newForKernelNamed: 'Pier') reportOfFile: 'STARTED_PHARO.txt' onPageAt: '/Blog/Social Tasks/Democracy Action/Check Image Save/Report' modifyUsing: [ :restartString || imageFile transactionFile prefix lastRestart lastLine | prefix := ''. lastRestart := DateAndTime epoch. (restartString isEmpty not and: [ (lastLine := restartString lines last) size > 74 ]) ifTrue: [ prefix := 'Pier last restarted: ', (lastLine copyFrom: 47 to: 74), String crlfcrlf. lastRestart := [ | date time | date := ((lastLine copyFrom: 51 to: 57), (lastLine copyFrom: 71 to: 74)) asDate. time := (lastLine copyFrom: 58 to: 65) asTime. DateAndTime date: date time: time ] on: Error do: [ DateAndTime epoch ] ]. (imageFile := FileLocator workingDirectory / 'pier_addons.image') exists ifFalse: [ 'Image file does not exist!' ] ifTrue: [ (transactionFile := FileLocator workingDirectory / 'transactions.txt') exists ifFalse: [ 'Transaction file does not exist!' ] ifTrue: [ ((FileSystem disk modificationTimeOf: transactionFile) between: (FileSystem disk modificationTimeOf: imageFile) and: lastRestart) ifTrue: [ prefix, 'NOT OK - Pier was restarted after changes but before image save' ] ifFalse: [ PRKernel instances size = 1 ifFalse: [ 'Code is not prepared for more than 1 kernel' ] ifTrue: [ (FileSystem disk modificationTimeOf: imageFile) > (FileSystem disk modificationTimeOf: transactionFile) ifTrue: [ prefix, 'A-OK - Image file is newer (' , (FileSystem disk modificationTimeOf: imageFile) asString , ')' ] ifFalse: [ PRKernel instances anyOne persistency duration > (DateAndTime now - (FileSystem disk modificationTimeOf: transactionFile)) ifTrue: [ prefix, 'Could be OK - There are unsaved edits, but transactions is not older than persistency duration' ] ifFalse: [ prefix, 'NOT OK - There are edits that may be lost!' ] ] ] ] ] ] ].
Explanation:
Other discoveries:
Smalltalk imageFile
is the memory file, it is constantly being updated - use the file name instead - Check with: FileSystem disk modificationTimeOf: Smalltalk imageFile