Commit Graph

32 Commits

Author SHA1 Message Date
Bharat Mediratta
bf2bb3e1ea Update copyright to 2012. #1822 2012-02-27 09:48:23 -08:00
Bharat Mediratta
423daa52d5 Update copyright to 2011. 2011-01-21 23:01:06 -08:00
Bharat Mediratta
b42fcb9cda Use db::expr instead of "new Database_Expression". Resolves #1560. 2010-12-28 23:10:05 -08:00
Bharat Mediratta
8d030cea64 Fix a bug where simultaneous deletes of the same item can result in it
deleting the first item row in the database.  The root issue is a bug
in Kohana that's addressed in dca9b5f3fc
but in this change we deal with the fact that reloading an item can
result in an instance of the item that's unloaded.  In those cases, we
should just ignore it and move on.  Fixes #1489.
2010-11-18 09:52:40 -08:00
Bharat Mediratta
b7cd2f73c5 PHPDoc fix. 2010-07-10 15:18:54 -07:00
Bharat Mediratta
0a42d74d55 Reset the time limit to 30 seconds every time we delete a child. Fixes ticket #1199. 2010-07-10 15:10:20 -07:00
Bharat Mediratta
c3c2b45280 Update the copyright to 2010. It's only 3 months into the year :-) 2010-03-03 10:15:34 -08:00
Bharat Mediratta
c050acf30a Fix lots of warnings that pop up when we're in E_STRICT mode. They're
mostly issues around uninitialized variables, calling non-static
functions in a static context, calling Session functions directly
instead of on its singleton, passing non-variables by reference, and
subclasses not using the same interface as the parent class.
2010-01-31 16:07:41 -08:00
Bharat Mediratta
4b32a71afc Convert back to using ORM::factory(..., $id) instead of calling where(). 2010-01-27 22:34:11 -08:00
Bharat Mediratta
e2b6cfc2d9 Make move_to protected since we don't want folks calling it on
Item_Model.  If there's a need to make this public, we should override
it in Item_Model and throw an exception there.
2010-01-20 23:47:48 -08:00
Bharat Mediratta
71a8375554 Whitespace. 2010-01-18 22:52:58 -08:00
Bharat Mediratta
dc570aaca9 Switch from ORM_MPTT::$db_builder to db::build(). 2010-01-18 22:52:23 -08:00
Bharat Mediratta
efa4e230da in move_to(), move the lock to before we do any calculations so that we have the latest data. 2010-01-18 21:40:00 -08:00
Bharat Mediratta
1066e64354 Call parent::save() before releasing the lock to make creating the hole and filling it an atomic operation. 2010-01-15 12:41:22 -08:00
Bharat Mediratta
50e3cc5837 Move model business logic out of album::create() and into
Item_Model::save().  This makes creating albums similar to editing
them and makes it difficult to create an album poorly.  I expect to be
able to remove a lot of code from the photo and movie helper because
it's duplicated here.

In order to do this, I refactored ORM_MPTT::add_to_parent() into
ORM_MPTT::save() so we now add it to the parent when we do save.  This
allows us to call save() only once which saves a database call per
add.

The Albums_Controller logic is roughly the same as before.

Haven't updated the tests yet, they're going to fail miserably since
many of them depend on album::create() which is now gone.
2010-01-15 12:15:20 -08:00
Bharat Mediratta
ad3e003e48 Remove stray semicolons. 2010-01-08 14:04:41 -08:00
Bharat Mediratta
3fc6dab7ac Expect merge_where and merge_or_where to handle empty tuples. 2010-01-08 11:49:01 -08:00
Bharat Mediratta
a6da027aad The default value for $offset should always be null (according to the
new K24 ORM).

Fix up a bad where tuple in the test.
2009-12-22 16:22:24 -08:00
Bharat Mediratta
62693db037 Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-05 17:56:31 -08:00
Bharat Mediratta
5c107be903 Reload relevant models after acquiring a lock so that we don't make
database calls based on obsolete data, which can lead to data corruption.

Fixes ticket #926.
2009-12-04 11:13:20 -08:00
Bharat Mediratta
96b00d6cfe Convert some more Database::instance() calls to db::build() form. 2009-11-26 21:14:54 -08:00
Bharat Mediratta
a3d904bcba ORM::find_all() now uses null as the default value for offset. 2009-11-26 19:36:57 -08:00
Bharat Mediratta
54be15191b Overload Database_Builder to add merge_where() which takes predefined
where clauses and adds them to the existing query.  Update all
existing queries that take an additional where clause to use it.
2009-11-26 18:47:40 -08:00
Bharat Mediratta
2e420522ec Preliminary work to cut over to Kohana 2.4
- Kohana::log() -> Kohana_Log::add()
- Kohana::config_XXX -> Kohana_Config::instance()->XXX
- Implement View::set_global in MY_View
- Updated Cache_Database_Driver to latest APIs
- ORM::$loaded -> ORM::loaded()
- Updated item::viewable() to use K2.4 parenthesization
2009-11-25 13:22:24 -08:00
Bharat Mediratta
752c857116 Rename ORM_MPTT::is_descendant() to ORM_MPTT::contains() to make the
API a little clearer.  Write a test for it, too.
2009-09-10 10:28:43 -07:00
Bharat Mediratta
dee0abfab9 Use is_descendant() API inside move_to() for clarity. 2009-08-30 15:04:39 -07:00
Bharat Mediratta
b394b0b2c6 Fix the default $orderby to be an associative array in descendants() and children(), thanks Tim! 2009-08-05 11:01:48 -07:00
Bharat Mediratta
e8c57290a2 Change the children and descendants APIs to be more consistent and to
remove Gallery3 concepts from ORM_MPTT.

The following API methods:
  ORM_MPTT::children
  ORM_MPTT::children_count
  ORM_MPTT::descendants
  ORM_MPTT::descendants_count

All now take a $where clause that allow you to pass through additional
field parameters.

old API:
  $album->children(10, 0, "photos")
  $album->children_count("photos")

new API:
  $album->children(10, 0, array("type" => "photos"))
  $album->children_count(array("type" => "photos"))

This gives us a more flexible API and simplifies the code.  While I
was in there, I changed the way we deal with default orderby values so
that we just assign the default value in the function definition,
which allows us to get rid of all conditionals in the implementation
which results in simpler code.
2009-08-05 10:38:53 -07:00
Tim Almdal
187d4b209d Change the children methods on Item_Core and ORM_MPTT in order to
specify a type parameter, so tht we can filter the children based
on type (i.e. album, photo, etc).
In addition, expose the sort order, so that we can specify the order
we want to return the children.
2009-08-05 07:38:35 -07:00
Romain LE DISEZ
23bb6eb7e3 Rename columns that use reserved SQL words : items.left and items.right 2009-07-25 19:06:54 +02:00
Bharat Mediratta
cd907c2b42 Change model_cache::clear() API to clear everything. This prevents
old ORM relationships from hanging around, which was causing problems
when doing MPTT manipulations (resulting in incorrect permission
propagation-- very bad!)
2009-07-17 12:51:27 -07:00
Bharat Mediratta
28b41056e3 Restructure things so that the application is now just another module.
Kohana makes this type of transition fairly straightforward in that
all controllers/helpers/etc are still located in the cascading
filesystem without any extra effort, except that I've temporarily
added a hack to force modules/gallery into the module path.

Rename what's left of "core" to be "application" so that it conforms
more closely to the Kohana standard (basically, just
application/config/config.php which is the minimal thing that you need
in the application directory)

There's still considerable work left to be done here.
2009-05-27 15:07:27 -07:00