Commit Graph

22 Commits

Author SHA1 Message Date
David Anderson 0d7d29e986 Web: various changes to remove PHP 8.1 warnings and errors
- implode() cares about arg order
- strlen(), strstr(), stripslashes() don't take null arg
- time() takes no args

There are probably others.
I don't currently have 8.1 set up, and am working off bug reports.
2022-06-11 00:00:08 -07:00
David Anderson 570541b134 Web: fix some PHP 8 deprecation warnings
Note: if a function expects, say, a string (and not null)
and you get a warning about a null arg,
don't fix it by casting the param to string.
That masks possible bugs.
Instead, find out where null is being passed, and fix it there.

web: server status: fix case where app has no results

web: fix case where get_logged_in_user() is called twice,
first with must_be_logged_in == false and later true.

web: xml_error(): $num default is -1

web: validate_email_addr(): tell user to check spam folder if no email
2022-06-09 14:33:20 -07:00
David Anderson ff91f05aa6 Tweaks to user URL/country flags
- Put flags in config.xml instead of project.inc
- Make them positive instead of negative
- make db_dump respect them.
2018-12-14 20:20:24 -08:00
David Anderson 65fc40fda2 move random_string() and dtime() from util.inc to util_basic.inc
PHP utilities that aren't web-specific should go in util_basic.inc
2018-04-27 14:17:56 -07:00
David Anderson c5b948020d Initial commit for Bootstrap 2016-11-11 12:36:27 -08:00
David Anderson c56f284904 remote job submission: improve error handling.
The way errors were being handled in submit_rpc_handler.php,
the replies could end up looking like:
<error>
    ...
    </error>
<actual_reply>
    ...
</actual_reply>

which doesn't parse with PHP's simplexml because there's no outer element.
So the PHP interface to job submission didn't work in some cases.

To fix this, I changed the RPC replies to have an enclosing element,
which is the name of the RPC, e.g.
<submit_batch>
    <error>
        ...
    </error>
    ... other stuff
</submit_batch>

RPC replies should now always be valid XML, errors or not.
2016-07-31 23:00:24 -07:00
David Anderson e11b62adab Improve error reporting for XML RPCs
- If handling an XML RPC, use set_error_handler() to output PHP warnings as XML.
Otherwise they appear as strings in the XML reply, making them not parse.

- suppress warnings from PHP function calls where we're already checking errors
2016-07-22 01:41:43 -07:00
Christian Beer 8c49d7cd88 Web: new utility function to retrieve contents of an url
The same as file_get_contents() but uses curl to also work if allow_url_fopen is set to false.
2015-12-09 17:00:50 +01:00
David Anderson b4dba535c0 web: fix typo 2014-06-21 13:40:02 -07:00
David Anderson 0337ce17c9 web: use "../.." to find the project dir.
Having a project symlink its html/ to a different dir doesn't work,
because if you cd into html/ops to run a script,
there's no way to know where the project dir is, so you can't find config.xml
2014-06-13 10:09:04 -07:00
David Anderson 4208b640d6 server: fix bug that prevented PHP scripts from working 2014-06-12 18:38:38 -07:00
Oliver Bock 395279cbe1 Respect symlinks when referring to project directory
* The previous implementation doesn't work if the /html directory is a symlink
* The new implementation supports symlinks while not adding any additional
  assumptions regarding relative file locations

Background:

BOINC's codebase consists of regular source code for compilation as well as
source code for direct deployment, such as the /html folder. Projects might
choose to use a checkout of the BOINC repository and a symlink in their deployed
project root directory targeting the /html directory to facilitate html-related
patch tracking and deployment (in situ). This requires the "html" symlink not to be
resolved during lookups of the project root directory (e.g. to access config.xml).
2014-06-12 15:42:52 +02:00
David Anderson 5381def663 server: use gpu_active_frac in scheduling decisions
On some hosts, gpu_active_frac may be much less than active_frac
(i.e., GPUs may be available much less than CPUs).
Use gpu_active_frac in the following places:

- scheduler: in estimating the elapsed time of jobs,
    to decide whether they can meet deadline
- scheduler: in computing the effective speed of a (host, app version),
    when deciding what size class it belongs to
- size_census: in computing effective speed of (host, app versions)

(Previously, we were just using active_frac in all these cases)
2014-03-06 21:23:02 -08:00
David Anderson ecdc25968a Extend PHP interface for Web RPCs
- add a PHP interface for lookup_account()
- PHP interfaces return error number as well as message
  (messages change; numbers don't)
- using symbolic error codes instead of hardwired numbers in PHP code
2013-12-28 22:50:59 -08:00
David Anderson 1c31f6feaa Condor: fix bug when 2 input files have same contents; fix error messages 2013-08-09 16:06:36 -07:00
David Anderson d95da0f75c - Condor integration:
- change "query_batch" to "query_batches"; allow multiple batches
    - add "ping server" web RPC and GAHP function
    - change BoincDb::get() so that it generates XML error message if needed
2013-03-22 10:25:39 +01:00
David Anderson 4dbe2c8fdf - new script sched/transitioner_catchup.php: transitions all WUs
that need it, then exits.
    For big projects coming up after an outage, run this before bin/start
    to minimize startup overload
- tweaks to PHP libraries to allow them to be used
    by scripts anywhere in the dir hierarchy


svn path=/trunk/boinc/; revision=22959
2011-01-29 06:28:10 +00:00
David Anderson e87f289544 - fix formatting in PHP code
svn path=/trunk/boinc/; revision=22623
2010-11-04 18:20:57 +00:00
David Anderson 37364ab657 - client: show message when suspending because of exclusive app
- web: remove file_get_contents() workaround for PHP4
- web: If Akismet or ReCaptcha failure,
    display the form again with a warning message at the top.
    That way the user doesn't lose the text they just typed.

svn path=/trunk/boinc/; revision=16175
2008-10-09 18:28:55 +00:00
David Anderson 9baf78fe5f - web: added copyright and license info to PHP files
svn path=/trunk/boinc/; revision=15758
2008-08-05 22:43:14 +00:00
David Anderson 8c41a07992 - scheduler: Add a notion of "hard app" for SETI@home.
If an app is hard, the scheduler always does the deadline check,
    even if the client has no other jobs for this project.
    And the estimated wallclock duration is multiplied by 1.3,
    to avoid sending jobs to hosts that will barely make the deadline.

    Hard apps are marked by setting weight = -1.
    This is a total kludge, to avoid adding another field to app.

svn path=/trunk/boinc/; revision=15607
2008-07-15 21:43:45 +00:00
David Anderson cf6a5281b6 - web: moved some basic utility functions to a separate file
that doesn't need to include all sorts of crap

svn path=/trunk/boinc/; revision=15368
2008-06-05 22:35:03 +00:00