Esempio n. 1
0
 private static function generateShareCountReport($config, $filename)
 {
     $date = date('c');
     $udate = date('U');
     $folder = $config['appdb']['shares']['path'] . "/";
     $appsdata = SocialReport::getAppDBdata($config);
     $apps = SocialReport::fetchSocialShares($appsdata, $config);
     $shares_xml = new SimpleXMLElement("<shares dateProduced=\"" . $date . "\" dateProduced_unix=\"" . $udate . "\" count=\"" . count($apps) . "\"></shares>");
     SocialReport::array_to_xml($apps, $shares_xml);
     $xml = $shares_xml->asXML();
     if ($xml === false) {
         error_log("[SocialReport::generateShareCountReport]: Could not generate xml " . $folder . $filename . ".xml");
         return false;
     }
     $writesuccess = file_put_contents($folder . $filename . ".xml", $xml);
     if ($writesuccess === false) {
         error_log("[SocialReport::generateShareCountReport]: Could not write to file " . $folder . $filename . ".xml");
         return false;
     }
     return true;
 }