public function store(Puny_Resource $resource)
 {
     // Build the full path from the resourceId
     $path = $this->dataDirectory . '/' . $resource->getId() . ".txt";
     // Store the latest content
     file_put_contents($path, $resource->getContent(true));
     // raw, unparsed content
 }
Example #2
0
 public function store(Puny_Resource $resource)
 {
     // Increment the resource version id... (see note in Puny_DataStore.class.php)
     $resource->incrementVersion();
     // Create sql for storing this new resource version...
     $sql = "INSERT INTO `{$this->tablePrefix}resource` (`resourceId`,`version`,`parser`,`content`) " . "VALUES (:resourceId, :version, :parser, :content) ";
     // Prepare and execute the statement using the provided data
     $stmt = $this->link->prepare($sql);
     $stmt->execute(array('resourceId' => $resource->getId(), 'version' => $resource->getVersion(), 'parser' => $resource->getParser(), 'content' => $resource->getContent(true)));
 }
 public function store(Puny_Resource $resource)
 {
     $doc = array("resourceId" => $resource->getId(), "version" => time(), "parser" => $resource->getParser(), "content" => $resource->getContent(true));
     // raw, unparsed content
     $this->collection->insert($doc);
 }