Permalink
Browse files

PHP examples moved to separate directories. Library updated.

  • Loading branch information...
1 parent 217ee69 commit a76ed534cb5e071b8931786eb2402b2bc0ad49b5 @thousandsofthem committed Jun 9, 2012
Showing with 298 additions and 471 deletions.
  1. +2 −0 .gitignore
  2. +0 −13 php/Airbrake.php
  3. +0 −32 php/Basic.php
  4. +0 −29 php/BasicShedule.php
  5. +0 −18 php/BasicSimplest.php
  6. +0 −20 php/FFmpeg.php
  7. +0 −26 php/FFmpegFlv.php
  8. +0 −110 php/Full.php
  9. +0 −16 php/Loggly.php
  10. +0 −28 php/Mongo.php
  11. +0 −19 php/Mysql.php
  12. +0 −27 php/PDO.php
  13. +0 −15 php/PagerDuty.php
  14. +0 −23 php/PharZend.php
  15. +6 −6 php/README.md
  16. +0 −19 php/Redis.php
  17. +0 −24 php/Twitter.php
  18. +10 −0 php/airbrake/enqueue.php
  19. +8 −0 php/airbrake/upload.php
  20. 0 php/{workers/airbrake → airbrake/worker}/airbrake.php
  21. 0 php/{workers/airbrake → airbrake/worker}/lib/Airbrake.class.php
  22. +6 −12 php/{BatchEmailer.php → batch_emailer/enqueue.php}
  23. +10 −0 php/batch_emailer/upload.php
  24. 0 php/{workers/batch_emailer → batch_emailer/worker}/contents.html
  25. BIN php/{workers/batch_emailer → batch_emailer/worker}/images/phpmailer.gif
  26. BIN php/{workers/batch_emailer → batch_emailer/worker}/images/phpmailer_mini.gif
  27. 0 php/{workers/batch_emailer → batch_emailer/worker}/lib/class.phpmailer.php
  28. 0 php/{workers/batch_emailer → batch_emailer/worker}/lib/class.pop3.php
  29. 0 php/{workers/batch_emailer → batch_emailer/worker}/lib/class.smtp.php
  30. 0 php/{workers/batch_emailer → batch_emailer/worker}/sendEmail.php
  31. 0 php/code/.gitkeep
  32. +8 −13 php/{GD_S3.php → draw_gd_and_upload_to_s3/enqueue.php}
  33. +7 −0 php/draw_gd_and_upload_to_s3/upload.php
  34. BIN php/{workers/draw_gd_and_upload_to_s3 → draw_gd_and_upload_to_s3/worker}/font/Ubuntu-R.ttf
  35. +1 −2 php/{workers/draw_gd_and_upload_to_s3 → draw_gd_and_upload_to_s3/worker}/gd_s3.php
  36. 0 php/{workers/draw_gd_and_upload_to_s3 → draw_gd_and_upload_to_s3/worker}/lib/S3.php
  37. +17 −0 php/ffmpeg_flv/enqueue.php
  38. +6 −0 php/ffmpeg_flv/upload.php
  39. 0 php/{workers/ffmpeg_flv → ffmpeg_flv/worker}/ffmpeg.php
  40. 0 php/{workers/ffmpeg_flv → ffmpeg_flv/worker}/functions.php
  41. +14 −0 php/ffmpeg_frames/enqueue.php
  42. +6 −0 php/ffmpeg_frames/upload.php
  43. 0 php/{workers/ffmpeg → ffmpeg_frames/worker}/ffmpeg.php
  44. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame0.gif
  45. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame1.gif
  46. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame10.gif
  47. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame11.gif
  48. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame12.gif
  49. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame13.gif
  50. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame2.gif
  51. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame3.gif
  52. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame4.gif
  53. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame5.gif
  54. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame6.gif
  55. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame7.gif
  56. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame8.gif
  57. BIN php/{workers/ffmpeg → ffmpeg_frames/worker}/frames/Frame9.gif
  58. +1 −2 php/hello_worker/enqueue.php
  59. +1 −2 php/hello_worker/upload.php
  60. +12 −0 php/loggly/enqueue.php
  61. +6 −0 php/loggly/upload.php
  62. 0 php/{workers/loggly → loggly/worker}/loggly.php
  63. +18 −0 php/mongo/enqueue.php
  64. +6 −0 php/mongo/upload.php
  65. 0 php/{workers/mongo → mongo/worker}/mongo.php
  66. +14 −0 php/mysql/enqueue.php
  67. +6 −0 php/mysql/upload.php
  68. 0 php/{workers/mysql → mysql/worker}/config.ini
  69. 0 php/{workers/mysql → mysql/worker}/testMysql.php
  70. +12 −0 php/pager_duty/enqueue.php
  71. +8 −0 php/pager_duty/upload.php
  72. 0 php/{workers/pager_duty → pager_duty/worker}/pagerDuty.php
  73. +21 −0 php/pdo/enqueue.php
  74. +6 −0 php/pdo/upload.php
  75. 0 php/{workers/PDO → pdo/worker}/Pdo.php
  76. +8 −0 php/phar_zend/enqueue.php
  77. +6 −0 php/phar_zend/upload.php
  78. 0 php/{workers/phar_zend_lib → phar_zend/worker}/pharZend.php
  79. BIN php/{workers/phar_zend_lib → phar_zend/worker}/zend/zf_1_11_0.phar.gz
  80. +8 −0 php/redis/enqueue.php
  81. +8 −0 php/redis/upload.php
  82. 0 php/{workers/php_redis → redis/worker}/lib/redis.peer.php
  83. 0 php/{workers/php_redis → redis/worker}/lib/redis.php
  84. 0 php/{workers/php_redis → redis/worker}/lib/redis.pool.php
  85. 0 php/{workers/php_redis → redis/worker}/lib/redis_list.peer.php
  86. 0 php/{workers/php_redis → redis/worker}/lib/redis_set.peer.php
  87. 0 php/{workers/php_redis → redis/worker}/testRedis.php
  88. +21 −0 php/scheduling/schedule.php
  89. +6 −0 php/scheduling/upload.php
  90. +3 −0 php/scheduling/worker/worker.php
  91. +18 −0 php/twitter/enqueue.php
  92. +8 −0 php/twitter/upload.php
  93. 0 php/{workers/post_to_twitter → twitter/worker}/config.ini
  94. 0 php/{workers/post_to_twitter → twitter/worker}/lib/OAuth.php
  95. 0 php/{workers/post_to_twitter → twitter/worker}/lib/TwitterOAuth.php
  96. 0 php/{workers/post_to_twitter → twitter/worker}/postToTwitter.php
  97. +0 −12 php/workers/hello_world/testTask.php
  98. +0 −3 php/workers/hello_world_simple/testTaskSimple.php
View
@@ -3,4 +3,6 @@
/config.ini
*.log
/php/code/*.zip
+/IronCore.class.php
/IronWorker.class.php
+/iron_worker.phar
View
@@ -1,13 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "airbrake-php";
-
-$iw = new IronWorker('config.ini');
-$iw->debug_enabled = true;
-
-$iw->upload(dirname(__FILE__)."/workers/airbrake", 'airbrake.php', $name);
-
-$payload = array('api_key' => AIRBRAKE_API_KEY);
-
-$iw->postTask($name, $payload);
View
@@ -1,32 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testBasic-php";
-
-$iw = new IronWorker('config.ini');
-
-$iw->upload(dirname(__FILE__)."/workers/hello_world", 'testTask.php', $name);
-
-$payload = array(
- 'key_one' => 'Helpful text',
- 'key_two' => 2,
- 'options' => array(
- 'option 1',
- 'option 2',
- 'option 3',
- 'option 4',
- 'option five'
- )
-);
-
-$task_id = $iw->postTask($name, $payload);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-$log = $iw->getLog($task_id);
-echo $log;
-
-
-
View
@@ -1,29 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testBasic-Schedule-php";
-
-$iw = new IronWorker('config.ini');
-
-$iw->upload(dirname(__FILE__)."/workers/hello_world", 'testTask.php', $name);
-
-$payload = array(
- 'key_one' => 'Payload',
- 'key_two' => 2
-);
-
-# 3 minutes later
-$start_at = time()+3*60;
-
-# Run task every 2 minutes 10 times
-$schedule_id = $iw->postScheduleAdvanced($name, $payload, $start_at, 2*60, null, 10);
-
-# Get schedule information
-$schedule = $iw->getSchedule($schedule_id);
-echo "Schedule:\n";
-print_r($schedule);
-
-echo "\ndone\n";
-
-
-
View
@@ -1,18 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testTaskSimple-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/hello_world_simple", 'testTaskSimple.php', $name);
-
-# Adding new task.
-$task_id = $iw->postTask($name);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-
View
@@ -1,20 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testFFmpeg-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/ffmpeg", 'ffmpeg.php', $name);
-
-# Adding new task.
-$task_id = $iw->postTask($name);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-# Get task log
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
View
@@ -1,26 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testFFmpeg-flv-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/ffmpeg_flv", 'ffmpeg.php', $name);
-
-# Adding new task.
-$payload = array(
- 'input_file' => 'https://s3.amazonaws.com/iron-examples/video/iron_man_2_trailer_official.flv'
-);
-$task_id = $iw->postTask($name, $payload);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-echo "Status: {$details->status}\n";
-
-# Get task log
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
-
-
-
View
@@ -1,110 +0,0 @@
-<?php
-include_once("../IronWorker.class.php");
-
-
-function tolog($name, $variable, $display = false){
- file_put_contents("log_{$name}.log", print_r($variable, true));
- if ($display){echo "{$name}: ".var_export($variable,true)."\n";}
-}
-
-$name = "testFull-php";
-
-$iw = new IronWorker('config.ini');
-$iw->debug_enabled = true;
-
-
-# ========================== Projects ===========================
-
-echo "\n--Get Project List------------------------------------\n";
-$projects = $iw->getProjects();
-tolog('projects', $projects);
-
-echo "\n--Get Project Details---------------------------------\n";
-$project_details = $iw->getProjectDetails();
-tolog('project_details', $project_details);
-
-# =========================== Codes =============================
-
-echo "\n--Posting Code----------------------------------------\n";
-$zipName = "code/$name.zip";
-$files_to_zip = array('testTask.php');
-# if true, good; if false, zip creation failed
-$zipFile = IronWorker::createZip(dirname(__FILE__)."/workers/hello_world", $files_to_zip, $zipName, true);
-if (!$zipFile) die("Zip file $zipName was not created!");
-
-$res = $iw->postCode('testTask.php', $zipName, $name);
-tolog('post_code', $res);
-
-echo "\n--Get Codes-------------------------------------------\n";
-$codes = $iw->getCodes();
-tolog('codes', $codes);
-
-echo "\n-Get Code Details--------------------------------------\n";
-$code_details = $iw->getCodeDetails($codes[0]->id);
-tolog('get_code_details', $code_details);
-
-# =========================== Tasks =============================
-
-echo "\n--Get Tasks-------------------------------------------\n";
-$tasks = $iw->getTasks();
-tolog('tasks', $tasks);
-
-echo "\n--Posting Task----------------------------------------\n";
-$task_id = $iw->postTask($name);
-tolog('post_task', $task_id, true);
-
-echo "\n--Wait For Task----------------------------------------\n";
-$details = $iw->waitFor($task_id);
-tolog('wait_for', $details, true);
-
-echo "\n--Get Task Details------------------------------------\n";
-$details = $iw->getTaskDetails($task_id);
-tolog('task_details', $details, true);
-
-echo "\n--Get Task Log----------------------------------------\n";
-sleep(15);
-# Check log only if task finished.
-if ($details->status != 'queued'){
- $log = $iw->getLog($task_id);
- tolog('task_log', $log, true);
-}
-
-echo "\n--Set Task Progress-----------------------------------\n";
-$res = $iw->setTaskProgress($task_id, 50, 'Job half-done');
-tolog('set_task_progress', $res, true);
-
-echo "\n--Deleting Task---------------------------------------\n";
-$res = $iw->deleteTask($task_id);
-tolog('delete_task', $res, true);
-
-# ========================== Schedules ==========================
-
-echo "\n--Posting Simple Shedule--------------------------------------\n";
-$schedule_id = $iw->postScheduleSimple($name, 10);
-tolog('post_schedule_simple', $schedule_id, true);
-
-echo "\n--Posting Advanced Shedule--------------------------------------\n";
-$schedule_id = $iw->postScheduleAdvanced($name, array(), time()+2*60, 50, null, 4, 0);
-tolog('post_schedule_advanced', $schedule_id, true);
-
-echo "\n--Get Schedules----------------------------------------\n";
-$schedules = $iw->getSchedules();
-tolog('schedules', $schedules);
-
-echo "\n--Get Schedule----------------------------------------\n";
-$schedule = $iw->getSchedule($schedule_id);
-tolog('schedule', $schedule);
-
-echo "\n--Deleting Shedule-------------------------------------\n";
-$res = $iw->deleteSchedule($schedule_id);
-tolog('delete_schedule', $res, true);
-
-
-
-
-
-
-
-
-
-echo "\ndone\n";
View
@@ -1,16 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "loggly-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/loggly", 'loggly.php', $name);
-
-for ($i = 1; $i <= 50; $i++)
-{
- $payload = array('api_key' => LOGGLY_KEY, 'i' => $i);
-
- $iw->postTask($name, $payload);
-}
View
@@ -1,28 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testMongo-php";
-
-$config = parse_ini_file('../config.ini', true);
-
-$iw = new IronWorker($config['iron_worker']);
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/mongo", 'mongo.php', $name);
-
-$payload = array(
- 'db' => $config['mongo']
-);
-
-$task_id = $iw->postTask($name, $payload);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-# Check log
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
-
-
-
View
@@ -1,19 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testMysql.php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/mysql", 'testMysql.php', $name);
-
-$task_id = $iw->postTask($name);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
-
View
@@ -1,27 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testPDO.php";
-
-$config = parse_ini_file('../config.ini', true);
-
-# Passing array of options instead of config file.
-$iw = new IronWorker($config['iron_worker']);
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/PDO", 'Pdo.php', $name);
-
-$payload = array(
- 'connection' => $config['pdo'],
- 'yet_another' => array('value', 'value #2')
-);
-
-$task_id = $iw->postTask($name, $payload);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
-
View
@@ -1,15 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "pagerDuty-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/pager_duty", 'pagerDuty.php', $name);
-
-$payload = array(
- 'API_KEY' => PAGERDUTY_API_KEY
-);
-
-$iw->postTask($name, $payload);
View
@@ -1,23 +0,0 @@
-<?php
-include("../IronWorker.class.php");
-
-$name = "testPharZend-php";
-
-$iw = new IronWorker('config.ini');
-
-# Creating and uploading code package.
-$iw->upload(dirname(__FILE__)."/workers/phar_zend_lib", 'pharZend.php', $name);
-
-$task_id = $iw->postTask($name);
-
-# Wait for task finish
-$details = $iw->waitFor($task_id);
-print_r($details);
-
-# Check log
-$log = $iw->getLog($task_id);
-echo "Task log:\n $log\n";
-
-
-
-
Oops, something went wrong.

0 comments on commit a76ed53

Please sign in to comment.