Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the table initialization ordering so index creation doesn't fail #59

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ fof-install.log
*~
cookies.txt
.idea

/vendor/
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ FeedOnFeeds requires:
and more are easy to add)
* Specific features may require specific PHP extensions; it is highly
recommended (but not required) that you have *Xlib*, *cURL*, and *iconv*.
* [Composer](https://getcomposer.org/)

To install, simply download a snapshot or clone from your favorite git
repository. Then copy `fof-config.php.dist` to `fof-config.php` and edit
it as appropriate for your setup. If you're on shared hosting, be sure
to point `FOF_DATA_PATH` to somewhere in your home directory.
To install:

After that, point a web browser to `install.php`. For example, if you've
installed FeedOnFeeds at `http://example.com/fof`, go to
`http://example.com/fof/install.php` and then everything should be set
up automatically.
1. Download a snapshot or clone from your favorite git repository
2. Run `composer install` to install/update the library dependencies
3. Copy `fof-config.php.dist` to `fof-config.php` and edit it as appropriate for your setup
* If you're on shared hosting, be sure to point `FOF_DATA_PATH` to somewhere in your home directory.
4. Point a web browser to `install.php`

For example, if you've installed FeedOnFeeds at `http://example.com/fof`, go to
`http://example.com/fof/install.php` and then everything should be set
up automatically.

### Which database backend should I use?

Expand Down
8 changes: 4 additions & 4 deletions add.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@
?>>no</option>
</select> items as unread<br><br>

RSS or reddit or weblog URL: <input type="text" name="rss_url" size="40" value="<?php echo htmlentities($url) ?>"><input type="Submit" value="Add a feed"><br><br>
RSS or reddit or weblog URL: <input type="text" name="rss_url" size="40" value="<?php echo htmlentities($url??"") ?>"><input type="Submit" value="Add a feed"><br><br>

YouTube channel page: <input type="text" name="youtube_channel" size="40" value="<?php echo htmlentities($youtube) ?>"><input type="Submit" value="Subscribe to channel"><br><br>
YouTube channel page: <input type="text" name="youtube_channel" size="40" value="<?php echo htmlentities($youtube??"") ?>"><input type="Submit" value="Subscribe to channel"><br><br>

OPML URL: <input type="hidden" name="MAX_FILE_SIZE" value="100000">

<input type="text" name="opml_url" size="40" value="<?php echo htmlentities($opml) ?>"><input type="Submit" value="Add feeds from OPML file on the Internet"><br><br>
<input type="text" name="opml_url" size="40" value="<?php echo htmlentities($opml??"") ?>"><input type="Submit" value="Add feeds from OPML file on the Internet"><br><br>

<input type="hidden" name="MAX_FILE_SIZE" value="100000">
OPML filename: <input type="file" name="opml_file" size="40" value="<?php echo htmlentities($file) ?>"><input type="Submit" value="Upload an OPML file">
OPML filename: <input type="file" name="opml_file" size="40" value="<?php echo htmlentities($file??"") ?>"><input type="Submit" value="Upload an OPML file">

</form>
<hr>
Expand Down
80 changes: 0 additions & 80 deletions autoloader.php

This file was deleted.

14 changes: 7 additions & 7 deletions classes/pdolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct($dsn, $username=null, $password=null, $driver_option
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatementLog', array($this)));
}

public function query($query, $fetchMode = null, ...$fetchModeArgs) {
public function query($query, $fetchMode = null, ...$fetchModeArgs): PDOStatement|false {
if (empty(self::$logfn))
return parent::query($query);

Expand All @@ -28,7 +28,7 @@ public function query($query, $fetchMode = null, ...$fetchModeArgs) {
return $result;
}

public function exec($statement) {
public function exec($statement): int|false {
if (empty(self::$logfn))
return parent::exec($statement);

Expand All @@ -48,17 +48,17 @@ protected function __construct($dbh) {
$this->parameters = array();
}

public function bindParam($parameter, &$variable, $data_type=PDO::PARAM_STR, $length=null, $driver_options=null) {
public function bindParam($parameter, &$variable, $data_type=PDO::PARAM_STR, $length=null, $driver_options=null): bool {
$this->parameters[$parameter] = $variable;
parent::bindParam($parameter, $variable, $data_type, $length, $driver_options);
return parent::bindParam($parameter, $variable, $data_type, $length, $driver_options);
}

public function bindValue($parameter, $value, $data_type=PDO::PARAM_STR) {
public function bindValue($parameter, $value, $data_type=PDO::PARAM_STR): bool {
$this->parameters[$parameter] = $value;
parent::bindValue($parameter, $value, $data_type);
return parent::bindValue($parameter, $value, $data_type);
}

public function execute($input_parameters=null) {
public function execute($input_parameters=null): bool {
if (empty(PDOLog::$logfn))
return parent::execute($input_parameters);

Expand Down
11 changes: 11 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "feed-on-feeds/feed-on-feeds",
"description": "A lightweight server-based RSS feed aggregator and reader",
"type": "project",
"require": {
"simplepie/simplepie": "dev-master",
"busybee/urljoin": "dev-main"
},
"license": "GPL",
"minimum-stability": "dev"
}
153 changes: 153 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions fof-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,11 +1254,15 @@ function fof_db_get_subscription_to_tags() {
while (($row = fof_db_get_row($statement)) !== false) {
$feed_id = $row['feed_id'];
$user_id = $row['user_id'];
$prefs = unserialize($row['subscription_prefs']);
if (isset($row['subscription_prefs'])) {
$prefs = unserialize($row['subscription_prefs']);
} else {
$prefs = [];
}
if (!isset($r[$feed_id])) {
$r[$feed_id] = array();
}
$r[$feed_id][$user_id] = $prefs['tags'];
$r[$feed_id][$user_id] = $prefs['tags'] ?? [];
}

return $r;
Expand Down Expand Up @@ -2152,7 +2156,7 @@ function fof_db_prefs_get($user_id) {
$result = $statement->execute();
$prefs = fof_db_get_row($statement, 'user_prefs', TRUE);

return unserialize($prefs);
return unserialize($prefs ?? "");
}

function fof_db_save_prefs($user_id, $prefs) {
Expand Down
Loading