# The personal, minimalist, super-fast, database free, bookmarking service.
# Makefile for PHP code analysis & testing, documentation and release generation
-# Prerequisites:
-# - install Composer, either:
-# - from your distro's package manager;
-# - from the official website (https://getcomposer.org/download/);
-# - install/update test dependencies:
-# $ composer install # 1st setup
-# $ composer update
-# - install Xdebug for PHPUnit code coverage reports:
-# - see http://xdebug.org/docs/install
-# - enable in php.ini
-
BIN = vendor/bin
PHP_SOURCE = index.php application tests plugins
PHP_COMMA_SOURCE = index.php,application,tests,plugins
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
// Max download size management
- curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024);
+ curl_setopt($ch, CURLOPT_BUFFERSIZE, 1024*16);
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION,
function($arg0, $arg1, $arg2, $arg3, $arg4 = 0) use ($maxBytes)
* Constructor
*
* @param array $session The $_SESSION array (reference)
- * @param ConfigManager $conf ConfigManager instance (reference)
+ * @param ConfigManager $conf ConfigManager instance
*/
- public function __construct(& $session, & $conf)
+ public function __construct(& $session, $conf)
{
$this->session = &$session;
- $this->conf = &$conf;
+ $this->conf = $conf;
}
/**
- by cloning the Git repository
- using Docker: [see the documentation](docker/shaarli-images)
----
+--------------------------------------------------------------------------------
## Latest release (recommended)
+
### Download as an archive
-Get the latest released version from the [releases](https://github.com/shaarli/Shaarli/releases) page.
-**Download our *shaarli-full* archive** to include dependencies.
+In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. **Download our *shaarli-full* archive** to include dependencies.
The current latest released version is `v0.9.1`
-Or in command lines:
-
```bash
$ wget https://github.com/shaarli/Shaarli/releases/download/v0.9.1/shaarli-v0.9.1-full.zip
$ unzip shaarli-v0.9.1-full.zip
$ mv Shaarli /path/to/shaarli/
```
-In most cases, download Shaarli from the [releases](https://github.com/shaarli/Shaarli/releases) page.
-Cloning using `git` or downloading Github branches as zip files requires additional steps (see below).
-
### Using git
+Cloning using `git` or downloading Github branches as zip files requires additional steps:
+
+ * Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
+ * Install [python3-virtualenv](https://pypi.python.org/pypi/virtualenv) to build the local HTML documentation.
+
```
$ mkdir -p /path/to/shaarli && cd /path/to/shaarli/
$ git clone -b latest https://github.com/shaarli/Shaarli.git .
$ composer install --no-dev --prefer-dist
$ make translate
+$ make htmldoc
```
+--------------------------------------------------------------------------------
+
## Stable version
The stable version has been experienced by Shaarli users, and will receive security updates.
+
### Download as an archive
As a .zip archive:
$ mv Shaarli-stable /path/to/shaarli/
```
-### Clone with Git
+### Using git
-[Composer](https://getcomposer.org/) is required to build a functional Shaarli installation when pulling from git.
+Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
```bash
$ git clone https://github.com/shaarli/Shaarli.git -b stable /path/to/shaarli/
$ composer install --no-dev --prefer-dist
```
+
+--------------------------------------------------------------------------------
+
## Development version (mainline)
_Use at your own risk!_
+Install [Composer](Unit-tests.md#install_composer) to manage Shaarli dependencies.
+
To get the latest changes from the `master` branch:
```bash
$ cd /path/to/shaarli
$ composer install --no-dev --prefer-dist
$ make translate
+$ make htmldoc
```
+-------------------------------------------------------------------------------
+
## Finish Installation
Once Shaarli is downloaded and files have been placed at the correct location, open it this location your favorite browser.
The framework used is [PHPUnit](https://phpunit.de/); it can be installed with [Composer](https://getcomposer.org/), which is a dependency management tool.
-Regarding Composer, you can either use:
+### Install composer
-- a system-wide version, e.g. installed through your distro's package manager
-- a local version, downloadable [here](https://getcomposer.org/download/)
+You can either use:
-#### Sample usage
+- a system-wide version, e.g. installed through your distro's package manager
+- a local version, downloadable [here](https://getcomposer.org/download/).
```bash
# system-wide version
#### Install and enable Xdebug to generate PHPUnit coverage reports
+See http://xdebug.org/docs/install
+
For Debian-based distros:
```bash
$ aptitude install php5-xdebug
<?php
+require_once 'tests/utils/FakeConfigManager.php';
+
// Initialize reference data _before_ PHPUnit starts a session
require_once 'tests/utils/ReferenceSessionIdHashes.php';
ReferenceSessionIdHashes::genAllHashes();
use \PHPUnit\Framework\TestCase;
-/**
- * Fake ConfigManager
- */
-class FakeConfigManager
-{
- public static function get($key)
- {
- return $key;
- }
-}
-
-
/**
* Test coverage for SessionManager
*/
// Session ID hashes
protected static $sidHashes = null;
+ // Fake ConfigManager
+ protected static $conf = null;
+
/**
* Assign reference data
*/
public static function setUpBeforeClass()
{
self::$sidHashes = ReferenceSessionIdHashes::getHashes();
+ self::$conf = new FakeConfigManager();
}
/**
public function testGenerateToken()
{
$session = [];
- $conf = new FakeConfigManager();
- $sessionManager = new SessionManager($session, $conf);
+ $sessionManager = new SessionManager($session, self::$conf);
$token = $sessionManager->generateToken();
$token => 1,
],
];
- $conf = new FakeConfigManager();
- $sessionManager = new SessionManager($session, $conf);
-
+ $sessionManager = new SessionManager($session, self::$conf);
// check and destroy the token
$this->assertTrue($sessionManager->checkToken($token));
public function testGenerateAndCheckToken()
{
$session = [];
- $conf = new FakeConfigManager();
- $sessionManager = new SessionManager($session, $conf);
+ $sessionManager = new SessionManager($session, self::$conf);
$token = $sessionManager->generateToken();
public function testCheckInvalidToken()
{
$session = [];
- $conf = new FakeConfigManager();
- $sessionManager = new SessionManager($session, $conf);
+ $sessionManager = new SessionManager($session, self::$conf);
$this->assertFalse($sessionManager->checkToken('4dccc3a45ad9d03e5542b90c37d8db6d10f2b38b'));
}
--- /dev/null
+<?php
+
+/**
+ * Fake ConfigManager
+ */
+class FakeConfigManager
+{
+ public static function get($key)
+ {
+ return $key;
+ }
+}
<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" />
<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" />
<link href="img/favicon.png" rel="shortcut icon" type="image/png" />
+<link href="img/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180" />
<link type="text/css" rel="stylesheet" href="css/pure.min.css?v={$version_hash}" />
<link type="text/css" rel="stylesheet" href="css/grids-responsive.min.css?v={$version_hash}">
<link type="text/css" rel="stylesheet" href="css/pure-extras.css?v={$version_hash}">
{loop="$plugins_includes.css_files"}
<link type="text/css" rel="stylesheet" href="{$value}?v={$version_hash}#"/>
{/loop}
-<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle}"/>
\ No newline at end of file
+<link rel="search" type="application/opensearchdescription+xml" href="?do=opensearch#" title="Shaarli search - {$shaarlititle}"/>