A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

refresh.py - Stikked
From Reliable Coyote, 12 Years ago, written in Python.
Embed
  1. #!/usr/bin/python
  2. from django.core.management import setup_environ
  3. from opstools import settings
  4. from urllib import urlopen
  5. from os import path, makedirs
  6. import md5
  7.  
  8. setup_environ(settings)
  9.  
  10. # your code goes here...
  11.  
  12. #vars
  13. username = 'user'
  14. passhash = 'pass'
  15. width = '825'
  16. height = '300'
  17. target_dir = 'mondash/static/mondash/graph'
  18.  
  19. from mondash.models import Server
  20. servers = Server.objects.all()
  21.  
  22. for web in servers:
  23.     web_hash = md5.new(web.urlname).hexdigest()[:12]
  24.  
  25.     if not path.exists(target_dir + '/' + web_hash):
  26.         makedirs(target_dir + '/' + web_hash)
  27.  
  28.     for sensor in web.sensor_set.all():
  29.         sensor_id = str(sensor.monitor_id)
  30.  
  31.         for time in [ '0', '1', '2' ]:
  32.             url = 'http://imonitor01.namics.home/chart.png'\
  33.             + '?username=' + username\
  34.             + '&passhash=' + passhash\
  35.             + '&type=graph&width=' + width + '&height=' + height\
  36.             + '&graphid=' + time\
  37.             + '&id=' + sensor_id
  38.  
  39.             content = urlopen(url).read()
  40.  
  41.             image = target_dir + '/' + web_hash + '/' + sensor_id + '-' + time + '.png'
  42.             print 'getting ' + image
  43.             f = open(image, 'w')
  44.             f.write(content)
  45.             f.close()