# Set the right directories define('IS_BOOTSTRAP', TRUE); $webroot = dirname(__FILE__) . '/../'; chdir($webroot); # Load up CodeIgniter require_once $webroot . 'index.php'; # Load up the spark libs $CI =& get_instance(); $CI->load->model('spark'); $CI->load->model('contributor'); $CI->load->spark('spark-sdk/1.0'); $CI->load->spark('markdown/1.1'); # Set the spark path $spark_path = WEBROOT . config_item('archive_path'); # Grab the unverified sparks $sparks = Spark::getUnverified(); # A place to hold successfull/unsuccessful $successful = array(); $unsuccessful = array(); # Roll through each unverified spark foreach ($sparks as $spark) { $handle = md5(uniqid()); $tmp = "/tmp/{$handle}"; # Create a temporary holding place mkdir($tmp); chdir($tmp); # Pull down a copy if ($spark->repository_type == 'hg') { `hg clone -r{$spark->tag} {$spark->base_location} {$tmp}`; } elseif ($spark->repository_type == 'git') { $token = 'spark-' . $spark->id . '-' . time();