Factory.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. class FreshRSS_Factory {
  3. public static function createCategoryDao($username = null) {
  4. return new FreshRSS_CategoryDAO($username);
  5. }
  6. public static function createFeedDao($username = null) {
  7. $conf = Minz_Configuration::get('system');
  8. switch ($conf->db['type']) {
  9. case 'sqlite':
  10. return new FreshRSS_FeedDAOSQLite($username);
  11. default:
  12. return new FreshRSS_FeedDAO($username);
  13. }
  14. }
  15. public static function createEntryDao($username = null) {
  16. $conf = Minz_Configuration::get('system');
  17. switch ($conf->db['type']) {
  18. case 'sqlite':
  19. return new FreshRSS_EntryDAOSQLite($username);
  20. case 'pgsql':
  21. return new FreshRSS_EntryDAOPGSQL($username);
  22. default:
  23. return new FreshRSS_EntryDAO($username);
  24. }
  25. }
  26. public static function createTagDao($username = null) {
  27. $conf = Minz_Configuration::get('system');
  28. switch ($conf->db['type']) {
  29. case 'sqlite':
  30. return new FreshRSS_TagDAOSQLite($username);
  31. case 'pgsql':
  32. return new FreshRSS_TagDAOPGSQL($username);
  33. default:
  34. return new FreshRSS_TagDAO($username);
  35. }
  36. }
  37. public static function createStatsDAO($username = null) {
  38. $conf = Minz_Configuration::get('system');
  39. switch ($conf->db['type']) {
  40. case 'sqlite':
  41. return new FreshRSS_StatsDAOSQLite($username);
  42. case 'pgsql':
  43. return new FreshRSS_StatsDAOPGSQL($username);
  44. default:
  45. return new FreshRSS_StatsDAO($username);
  46. }
  47. }
  48. public static function createDatabaseDAO($username = null) {
  49. $conf = Minz_Configuration::get('system');
  50. switch ($conf->db['type']) {
  51. case 'sqlite':
  52. return new FreshRSS_DatabaseDAOSQLite($username);
  53. case 'pgsql':
  54. return new FreshRSS_DatabaseDAOPGSQL($username);
  55. default:
  56. return new FreshRSS_DatabaseDAO($username);
  57. }
  58. }
  59. }