DiamondLightSource/SynchWeb

making code portable

Closed this issue · 3 comments

I'm sure you are already aware of this, and I don't expect that it is super high on your todo list, but there are a few hardcoded DLS-specific things in the synchweb code. This is something you might want to address in order to make synchweb more portable.

For example the _get_archive function in class.page.php has a call to what looks like your facility EPICS server (archiver.pri.diamond.ac.uk) to get beam parameters etc. Some of these calls cause php errors:

ErrorException: sizeof(): Parameter must be an array or an object that implements Countable in /var/www/sites/synchweb/api/includes/pages/class.vstat.php:430
Stack trace:
#0 [internal function]: Slim\Slim::handleErrors(2, 'sizeof(): Param...', '/var/www/sites/...', 430, Array)
#1 /var/www/sites/synchweb/api/includes/pages/class.vstat.php(430): sizeof(NULL)
#2 [internal function]: Vstat->_pies('cm1234-1')
#3 /var/www/sites/synchweb/api/lib/Slim/Route.php(462): call_user_func_array(Array, Array)
#4 /var/www/sites/synchweb/api/lib/Slim/Slim.php(1326): Slim\Route->dispatch()
#5 /var/www/sites/synchweb/api/lib/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#6 /var/www/sites/synchweb/api/lib/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#7 /var/www/sites/synchweb/api/lib/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#8 /var/www/sites/synchweb/api/lib/Slim/Slim.php(1271): Slim\Middleware\PrettyExceptions->call()
#9 /var/www/sites/synchweb/api/includes/class.dispatch.php(64): Slim\Slim->run()
#10 /var/www/sites/synchweb/api/index.php(95): Dispatch->dispatch()
#11 {main}

Yer i know about these. I am trying to make it more site agnostic, but there are other priorities atm. I'd like to pluginify the filescraping as well (until its all moved into the db). You'd made a comment about something else hardcoded, but i cant find it now?

More hard-coded references can be found with the following:

$ grep -Ilr '[^@]diamond\.ac\.uk' . | fgrep -v '/docs/'
./api/assets/emails/container-report.html
./api/assets/emails/dewar-rack.html
./api/assets/emails/dewar-report.html
./api/assets/emails/html/container-report.html
./api/assets/emails/html/dewar-rack.html
./api/assets/emails/html/dewar-report.html
./api/assets/emails/html/imaging-new.html
./api/assets/emails/html/storage-rack.html
./api/assets/emails/html/data-new.html
./api/assets/emails/html/dewar-stores-in-in.html
./api/assets/emails/html/dewar-stores-in.html
./api/assets/emails/imaging-new.html
./api/assets/emails/storage-rack.html
./api/assets/emails/data-new.html
./api/assets/emails/dewar-stores-in-in.html
./api/assets/emails/dewar-stores-in.html
./api/formulatrix/uploader/formulatrix_uploader.py
./api/includes/class.page.php
./api/includes/pages/class.fault.php
./api/includes/pages/class.image.php
./api/includes/pages/class.vstat.php
./client/index.html
./client/index.php
./client/js/templates/fault/view.html

Closing for now. Seems a specific suggestion is better than this broad issue.