Introduce file locking as an app
Adjust namespaces
Added shipped flag
Fix infinite loop when fopen failed when obtaining lock

If for some reason fopen() fails in obtainReadLock() or
obtainWriteLock(), the function now returns with false instead of
needlessly trying to acquire a lock.

The original issue had the "false" $handle caused an infinite loop in
the do-while block.
Setup file locking storage wrapped in setup hook

This fixes an issue when using file locking + encryption and try to list
a shared mount in the web UI.

Using the setup hook prevents having setupFS() be called twice in a row
and mess up with the mount points.
Do not try locking directories

Some operations like $storage->rename() can replace a target folder with
a source folder. In such cases, the flock app must not try and lock the
folder (only file locking is supported anyway).
Fix zero size files on upload

When checking is_dir() whenever a file is being uploaded, the file's
size will initially be zero when requesting a lock. is_dir() will
internally populate the stat cache with that zero size, which cause
subsequent calles to file_size to return zero instead of the real size,
even after the file contents is there.

This fix clears the stat cache after the is_dir() call to make sure the
newly read values are the correct ones, not the cached ones.
Lock retry usleep requires milliseconds

Convert the milliseconds wait interval value to microseconds in the
files locking app
Fix copy operation

Do not use locks when moving or copying folders to avoid creating empty
files.

Moved is_dir() check to the storage wrapper's rename() and copy() methods.
Now using $this->storage for the is_dir() check.

Removed clearstatcache() which does not seem to be needed any more when
using $this->storage.
Save the locked handle in obtainWriteLock
Adding unit tests
Merge pull request #1941 from owncloud/add-file-locking-units

Adding unit tests
Updated info.xml app description

Updated app description to align with others
Correctly normalize absolute paths so locking works on windows
Make all tests extend the new \Test\TestCase
Use a static class variable instead of function internal and always create dir
Dont save existing file handles in locks
Fix infinite loops when getting a read lock
Clean up lock objects of files that no longer exist
When renaming, pass over the locks to the new path