function store_favicon($feed_id, $link, $type, $icon) { $file = $feed_id . Helper\favicon_extension($type); if (file_put_contents(FAVICON_DIRECTORY . DIRECTORY_SEPARATOR . $file, $icon) === false) { return false; } return Database::getInstance('db')->table('favicons')->save(array('feed_id' => $feed_id, 'link' => $link, 'file' => $file, 'type' => $type)); }
function delete_favicon($favicon) { unlink(FAVICON_DIRECTORY . DIRECTORY_SEPARATOR . $favicon['hash'] . Helper\favicon_extension($favicon['type'])); Database::getInstance('db')->table('favicons')->eq('hash', $favicon['hash'])->remove(); }