mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
52
.doc/README.md
Normal file
52
.doc/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# phpdoc dokuwiki template
|
||||
This directory contains a template rendering iTop phpdoc as wiki pages.
|
||||
|
||||
|
||||
|
||||
## special instructions
|
||||
|
||||
some tags where added :
|
||||
* `@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use
|
||||
* `@overwritable-hook`: used to mark a method as "designed to be extended"
|
||||
* `@extension-hook`: not used for now
|
||||
* `@phpdoc-tunning-exclude-inherited`: tunning tag that inform this template to ignere inherited methods in the rendrering.
|
||||
|
||||
some behaviours where added :
|
||||
* only public `@api` and `@api-advanced` are showed
|
||||
* class properties are hidden (subject to change, but will require to white list them using `@api` tag)
|
||||
|
||||
known limitations:
|
||||
* inline tag do not work properly
|
||||
* links are hardcoded instead of using phpdoc routes (adding our own routes was too complex)
|
||||
* `@see` tags must be very specific:
|
||||
* always prefix class members with `Class::` (ie: `DBObject::Get()`)
|
||||
* for methods always suffix them with `()`,
|
||||
* for variables, always prefix them with `$`.
|
||||
* do not use inline @see
|
||||
* as spaces are used to mark code, the templates have very few indentation, thus they are awful to read (sorry)
|
||||
* `@example`
|
||||
* the sentence in the first line (next to the tag) is the title, it must be enclose by double quotes
|
||||
* the following lines are the sample code.
|
||||
* 💔 since we simply hack the official tag, this syntax must be respected carefully 💔
|
||||
|
||||
|
||||
|
||||
## dokuwiki requirements
|
||||
* the templates uses the [wrap plugin](https://www.dokuwiki.org/plugin:wrap).
|
||||
* the generated files have to be placed under an arbitrary directory of `[/path/to/dokuwiki]/data/pages`.
|
||||
* the html as to be activated [config:htmlok](https://www.dokuwiki.org/config:htmlok)
|
||||
* the generated files have to be in lowercase
|
||||
|
||||
## installation
|
||||
```
|
||||
composer require phpdocumentor/phpdocumentor:~2 --dev
|
||||
```
|
||||
|
||||
## bin
|
||||
`.doc/bin/build-doc-object-manipulation` and `.doc/bin/build-doc-extensions` contains examples of doc. generation, beware: they have to be called from iTop root directory:
|
||||
```shell
|
||||
cd /path/to/itop/
|
||||
./.doc/bin/build-doc-object-manipulation
|
||||
```
|
||||
|
||||
the resulting documentation is written into `data/phpdocumentor/output`
|
||||
7
.doc/bin/build-doc-extensions
Executable file
7
.doc/bin/build-doc-extensions
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && vendor/bin/phpdoc -c .doc/phpdoc-extensions.dist.xml -vvv
|
||||
|
||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
||||
cd data/phpdocumentor/output/extensions/
|
||||
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
|
||||
8
.doc/bin/build-doc-object-manipulation
Executable file
8
.doc/bin/build-doc-object-manipulation
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh -x
|
||||
|
||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/objects-manipulation/ && rm -rf data/phpdocumentor/temp/objects-manipulation/ && vendor/bin/phpdoc -c .doc/phpdoc-objects-manipulation.dist.xml -vvv
|
||||
|
||||
|
||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
||||
cd data/phpdocumentor/output/objects-manipulation/
|
||||
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
|
||||
20
.doc/phpdoc-extensions.dist.xml
Executable file
20
.doc/phpdoc-extensions.dist.xml
Executable file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdoc>
|
||||
<title><![CDATA[iTop extensions]]></title>
|
||||
|
||||
<parser>
|
||||
<target>../data/phpdocumentor/temp/extensions</target>
|
||||
</parser>
|
||||
|
||||
<transformer>
|
||||
<target>../data/phpdocumentor/output/extensions</target>
|
||||
</transformer>
|
||||
|
||||
<transformations>
|
||||
<template name="phpdoc-templates/combodo-wiki"/>
|
||||
</transformations>
|
||||
|
||||
<files>
|
||||
<file>../application/applicationextension.inc.php</file>
|
||||
</files>
|
||||
</phpdoc>
|
||||
58
.doc/phpdoc-objects-manipulation.dist.xml
Executable file
58
.doc/phpdoc-objects-manipulation.dist.xml
Executable file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdoc>
|
||||
|
||||
<!--
|
||||
/**
|
||||
The documentation of this file can be found here : https://docs.phpdoc.org/references/configuration.html
|
||||
it has to be completed by the CLI parameters documentation which is more comprehensive: https://docs.phpdoc.org/references/commands/project_run.html#usage
|
||||
|
||||
usage:
|
||||
vendor/bin/phpdoc -c phpdoc-objects-manipulation.dist.xml
|
||||
|
||||
*/
|
||||
-->
|
||||
|
||||
<title><![CDATA[iTop's objects manipulation API]]></title>
|
||||
|
||||
<parser>
|
||||
<default-package-name>iTopORM</default-package-name>
|
||||
<target>../data/phpdocumentor/temp/objects-manipulation</target>
|
||||
<visibility>public,protected</visibility>
|
||||
<markers>
|
||||
<!--<item>TODO</item>-->
|
||||
<!--<item>FIXME</item>-->
|
||||
</markers>
|
||||
<extensions>
|
||||
<extension>php</extension>
|
||||
</extensions>
|
||||
</parser>
|
||||
|
||||
<transformer>
|
||||
<target>../data/phpdocumentor/output/objects-manipulation</target>
|
||||
</transformer>
|
||||
|
||||
<transformations>
|
||||
<template name="phpdoc-templates/combodo-wiki"/>
|
||||
</transformations>
|
||||
|
||||
<!--<logging>-->
|
||||
<!--<level>warn</level>-->
|
||||
<!--<paths>-->
|
||||
<!--<!–<default>data/phpdocumentor/log/objects-manipulation/{DATE}.log</default>–>-->
|
||||
<!--<!–<errors>data/phpdocumentor/log/objects-manipulation/{DATE}.errors.log</errors>–>-->
|
||||
|
||||
<!--<default>{APP_ROOT}/data/log/{DATE}.log</default>-->
|
||||
<!--<errors>{APP_ROOT}/data/log/{DATE}.errors.log</errors>-->
|
||||
<!--</paths>-->
|
||||
<!--</logging>-->
|
||||
|
||||
<files>
|
||||
<file>../core/dbobject.class.php</file>
|
||||
<file>../core/dbobjectsearch.class.php</file>
|
||||
<file>../core/metamodel.class.php</file>
|
||||
<file>../core/dbobjectset.class.php</file>
|
||||
<file>../core/dbsearch.class.php</file>
|
||||
<file>../core/dbunionsearch.class.php</file>
|
||||
</files>
|
||||
|
||||
</phpdoc>
|
||||
0
.doc/phpdoc-templates/.placeholder
Normal file
0
.doc/phpdoc-templates/.placeholder
Normal file
136
.doc/phpdoc-templates/combodo-wiki/class.txt.twig
Normal file
136
.doc/phpdoc-templates/combodo-wiki/class.txt.twig
Normal file
@@ -0,0 +1,136 @@
|
||||
{% extends 'layout.txt.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<wrap button>[[start|🔙 Back]]</wrap>
|
||||
|
||||
{% if node.tags['internal'] is defined %}
|
||||
====== {{ node.name }} ======
|
||||
<WRAP alert>This class is "internal", and thus is not documented!</WRAP>
|
||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
||||
====== {{ node.name }} ======
|
||||
<WRAP alert>This class is neither "api", "api-advanced", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
||||
{% else %}
|
||||
|
||||
====== {{ node.name }} ======
|
||||
|
||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
||||
|
||||
|
||||
|
||||
{% if node.deprecated %}
|
||||
=== **<del>Deprecated</del>**===
|
||||
//{{ node.tags.deprecated[0].description }}//
|
||||
{% endif %}
|
||||
|
||||
|
||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
||||
<html>{{ node.description|markdown|raw }}</html>
|
||||
|
||||
|
||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
||||
|
||||
|
||||
{% set class = node.parent %}
|
||||
{% block hierarchy_element %}
|
||||
|
||||
{% if class and class.name is defined and class.name|trim != '' %}
|
||||
==== parent ====
|
||||
{% set child = class %}
|
||||
{% set class = class.parent %}
|
||||
{{ block('hierarchy_element') }}
|
||||
[[{{ child.name }}|{{ child.name }}]]
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% for interface in node.interfaces|sort_asc %}
|
||||
{% if loop.first %}
|
||||
==== Implements ====
|
||||
{% endif %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for trait in node.usedTraits|sort_asc %}
|
||||
{% if loop.first %}
|
||||
==== Uses traits ====
|
||||
{% endif %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
||||
|
||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tunning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
||||
|
||||
{% set methods = node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
||||
|
||||
|
||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '=====', sub_title_level: '=='} %}
|
||||
|
||||
<WRAP clear />
|
||||
|
||||
{% for method in methods|sort_asc
|
||||
if method.visibility == 'public'
|
||||
and (
|
||||
method.tags['api'] is defined
|
||||
or method.tags['api-advanced'] is defined
|
||||
or method.tags['overwritable-hook'] is defined
|
||||
or method.tags['extension-hook'] is defined
|
||||
)
|
||||
and (
|
||||
node.tags['phpdoc-tunning-exclude-inherited'] is not defined
|
||||
or method.parent.name == node.name
|
||||
)
|
||||
%}
|
||||
{%- if loop.first %}
|
||||
===== Public methods =====
|
||||
{% endif %}
|
||||
{{ block('method') }}
|
||||
{% endfor %}
|
||||
{% for method in methods|sort_asc if method.visibility == 'protected' and (method.tags['overwritable-hook'] is defined or method.tags['extension-hook'] is defined) %}
|
||||
{%- if loop.first %}
|
||||
===== Protected methods =====
|
||||
{% endif %}
|
||||
{{ block('method') }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
||||
{% if constants|length > 0 %}
|
||||
===== Constants =====
|
||||
{% for constant in constants|sort_asc %}
|
||||
{{ block('constant') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{#{% set properties = node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) %}#}
|
||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
||||
{#{%- if loop.first %}#}
|
||||
{#===== Public properties =====#}
|
||||
{#{% endif %}#}
|
||||
{#{{ block('property') }}#}
|
||||
{#{% endfor %}#}
|
||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
||||
{#{%- if loop.first %}#}
|
||||
{#===== Protected properties =====#}
|
||||
{#{% endif %}#}
|
||||
{#{{ block('property') }}#}
|
||||
{#{% endfor %}#}
|
||||
|
||||
|
||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
||||
|
||||
<wrap button>[[start|🔙 Back]]</wrap>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% block constant %}
|
||||
|
||||
<WRAP group box >
|
||||
<WRAP twothirds column >
|
||||
==== {{ constant.name }} ====
|
||||
</WRAP>{# twothirds column#}
|
||||
|
||||
<WRAP third column>
|
||||
{% if constant.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
||||
{% if (node.parent is not null and constant.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
||||
</WRAP>{# third column#}
|
||||
|
||||
== {{ constant.summary|replace({"\n":""})|raw }} ==
|
||||
<html>{{ constant.description|markdown|raw }}</html>
|
||||
|
||||
{% if constant.deprecated %}
|
||||
=== Deprecated ===
|
||||
{{ constant.tags.deprecated[0].description|raw }}
|
||||
{% endif %}
|
||||
|
||||
{% include 'includes/inherited-from.txt.twig' with {structure:constant} %}
|
||||
|
||||
{% include 'includes/see-also.txt.twig' with {structure:constant, title_level: '=='} %}
|
||||
|
||||
{% include 'includes/uses.txt.twig' with {structure:constant, title_level: '=='} %}
|
||||
|
||||
{% include 'includes/tags.txt.twig' with {structure:constant, title_level: '==', blacklist: ['link', 'see', 'var', 'deprecated', 'uses', 'package', 'subpackage', 'todo', 'code-example']} %}
|
||||
|
||||
</WRAP>{# group #}
|
||||
|
||||
{% endblock %}
|
||||
95
.doc/phpdoc-templates/combodo-wiki/elements/method.txt.twig
Normal file
95
.doc/phpdoc-templates/combodo-wiki/elements/method.txt.twig
Normal file
@@ -0,0 +1,95 @@
|
||||
{% block method %}
|
||||
|
||||
|
||||
<WRAP group box >
|
||||
<WRAP twothirds column >
|
||||
==== {{ method.name }} ====
|
||||
</WRAP>{# twothirds column#}
|
||||
<WRAP third column >
|
||||
{% include 'includes/wrap-tags.txt.twig' with {structure:method, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
||||
{% if method.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
||||
{% if (node.parent is not null and method.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
||||
{% if method.abstract %}<wrap warning>abstract</wrap> {% endif %}
|
||||
{% if method.final %}<wrap notice>final</wrap> {% endif %}
|
||||
<wrap notice>{{ method.visibility }}</wrap>
|
||||
{% if method.static %}<wrap warning>static</wrap> {% endif %}
|
||||
</WRAP>{# third column#}
|
||||
|
||||
|
||||
== {{ method.summary|replace({"\n":""})|raw }} ==
|
||||
<html>{{ method.description|markdown|raw }}</html>
|
||||
|
||||
<code php>{% if method.abstract %}abstract {% endif %}{% if method.final %}final {% endif %}{{ method.visibility }} {% if method.static %}static {% endif %}{{ method.name }}({% for argument in method.arguments %}{{ argument.isVariadic ? '...' }}{{ argument.name }}{{ argument.default ? (' = '~argument.default)|raw }}{% if not loop.last %}, {% endif %}{% endfor %})</code>
|
||||
|
||||
<WRAP twothirds column >
|
||||
|
||||
|
||||
=== Parameters ===
|
||||
{% if method.arguments|length > 0 -%}
|
||||
^ types ^ name ^ default ^ description ^
|
||||
{% for argument in method.arguments -%}
|
||||
| **<nowiki>{{ argument.types|join('|')|raw }}</nowiki>** | {{ argument.name }} {{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }} | <nowiki>{{ argument.default|raw }}</nowiki> | {{ argument.description|trim|replace("\n", ' ')|raw }} |{{ "\r\n" }}
|
||||
{%- endfor %}
|
||||
{% else %}
|
||||
//none//
|
||||
{% endif %}
|
||||
|
||||
|
||||
{#=== Parameters ===#}
|
||||
{#{% if method.arguments|length > 0 -%}#}
|
||||
{#{% for argument in method.arguments -%}#}
|
||||
{#== {{ argument.name }} ==#}
|
||||
|
||||
|
||||
{#{% set varDesc %}#}
|
||||
{#<span style="margin:0 10px; 0 20px; font-weight: bold;">{{ argument.types|join('|') }}</span>#}
|
||||
{#{{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }}#}
|
||||
{#{{ argument.description|raw }}#}
|
||||
{#{% endset %}#}
|
||||
{#<html>{{ varDesc|markdown|raw }}</html>#}
|
||||
{#{%- endfor %}#}
|
||||
{#{% else %}#}
|
||||
{#<wrap tip>This method has no parameter</wrap>#}
|
||||
{#{% endif %}#}
|
||||
|
||||
|
||||
{% if method.response and method.response.types|join() != 'void' %}
|
||||
=== Returns ===
|
||||
<html>{{ ('**' ~ method.response.types|join('|')|trim ~ '** ' ~ method.response.description)|markdown|raw }}</html>
|
||||
{% endif %}
|
||||
|
||||
</WRAP>{# twothirds column#}
|
||||
|
||||
<WRAP third column >
|
||||
|
||||
{% if method.tags.throws|length > 0 or method.tags.throw|length > 0 %}
|
||||
=== Throws ===
|
||||
{% for exception in method.tags.throws -%}
|
||||
{% if loop.length > 1 %} * {% endif %}''{{ exception.types|join('|')|raw }}'' <nowiki>{{ exception.description|raw }}</nowiki>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% include 'includes/inherited-from.txt.twig' with {structure:method} %}
|
||||
|
||||
{% include 'includes/see-also.txt.twig' with {structure:method, title_level: '==='} %}
|
||||
|
||||
{% include 'includes/uses.txt.twig' with {structure:method, title_level: '==='} %}
|
||||
|
||||
{% include 'includes/used-by.txt.twig' with {structure:method, title_level: '==='} %}
|
||||
|
||||
{% include 'includes/tags-with-description.txt.twig' with {structure:method, title_level: '===', WRAP: 'info', tagsWithDescription: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
||||
|
||||
{% include 'includes/tags.txt.twig' with {structure:method, title_level: '===', blacklist: ['todo', 'link', 'see', 'abstract', 'example', 'param', 'return', 'access', 'deprecated', 'throws', 'throw', 'uses', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'used-by', 'inheritdoc', 'code-example']} %}
|
||||
|
||||
</WRAP>{# third column#}
|
||||
|
||||
|
||||
|
||||
{% include 'includes/code-examples.txt.twig' with {structure:method, title_level: '==='} %}
|
||||
|
||||
</WRAP>{# group #}
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,49 @@
|
||||
{% block property %}
|
||||
|
||||
<WRAP group box>
|
||||
<WRAP twothirds column >
|
||||
==== ${{ property.name }} ====
|
||||
</WRAP>{# twothirds column#}
|
||||
|
||||
<WRAP third column>
|
||||
{% if property.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
||||
{% if (node.parent is not null and property.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
||||
</WRAP>{# third column#}
|
||||
|
||||
|
||||
|
||||
|
||||
== {{ property.summary|replace({"\n":""})|raw }} ==
|
||||
<html>{{ property.description|markdown|raw }}</html>
|
||||
{% if property.var.0.description %}<html>{{ property.var.0.description|markdown|raw }}</html>{% endif %}
|
||||
|
||||
|
||||
|
||||
{#{% if property.types %}#}
|
||||
{#== Type ==#}
|
||||
{#{% for type in property.types %}#}
|
||||
{#{% if loop.length > 1 %} * {% endif %}{{ type|raw }} : {{ type.description|raw }}#}
|
||||
{#{% endfor %}#}
|
||||
{#{{ property.types|join('|')|raw }}#}
|
||||
{#{% endif %}#}
|
||||
|
||||
|
||||
{% if property.deprecated %}
|
||||
== Deprecated ==
|
||||
{{ property.tags.deprecated[0].description }}
|
||||
{% endif %}
|
||||
|
||||
{% include 'includes/inherited-from.txt.twig' with {structure:property} %}
|
||||
|
||||
{% include 'includes/see-also.txt.twig' with {structure:property, title_level: '=='} %}
|
||||
|
||||
{% include 'includes/uses.txt.twig' with {structure:property, title_level: ''} %}
|
||||
|
||||
{% include 'includes/tags.txt.twig' with {structure:property, title_level: '==', blacklist: ['link', 'see', 'access', 'var', 'deprecated', 'uses', 'todo', 'code-example']} %}
|
||||
|
||||
|
||||
<code php>{{ property.visibility }} ${{ property.name }}{% if property.types %} : {{ property.types|join('|')|raw }}{% endif %}</code>
|
||||
|
||||
</WRAP>{# group #}
|
||||
|
||||
{% endblock %}
|
||||
1
.doc/phpdoc-templates/combodo-wiki/file.source.txt.twig
Normal file
1
.doc/phpdoc-templates/combodo-wiki/file.source.txt.twig
Normal file
@@ -0,0 +1 @@
|
||||
{{ node.source|raw }}
|
||||
122
.doc/phpdoc-templates/combodo-wiki/file.txt.twig
Normal file
122
.doc/phpdoc-templates/combodo-wiki/file.txt.twig
Normal file
@@ -0,0 +1,122 @@
|
||||
{% extends 'layout.txt.twig' %}
|
||||
|
||||
{% block javascripts %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{#<section class="row-fluid">#}
|
||||
{#<div class="span2 sidebar">#}
|
||||
{#{% set namespace = project.namespace %}#}
|
||||
{#{{ block('sidebarNamespaces') }}#}
|
||||
{#</div>#}
|
||||
{#</section>#}
|
||||
{#<section class="row-fluid">#}
|
||||
====== {{ node.path|split('/')|slice(0,-1)|join('/') }}{{ node.name }} ======
|
||||
{{ node.summary }}
|
||||
<html>{{ node.description|markdown|raw }}</html>
|
||||
|
||||
{% if node.traits|length > 0 %}
|
||||
|
||||
===== Traits =====
|
||||
{% for trait in node.traits %}
|
||||
<tr>
|
||||
<td>{{ trait|raw }}</td>
|
||||
<td><em>{{ trait.summary }}</em></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if node.interfaces|length > 0 %}
|
||||
===== Interfaces =====
|
||||
{% for interface in node.interfaces %}
|
||||
<tr>
|
||||
<td>{{ interface|raw }}</td>
|
||||
<td><em>{{ interface.summary }}</em></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if node.classes|length > 0 %}
|
||||
===== Classes =====
|
||||
{% for class in node.classes %}
|
||||
{{ class|raw }}
|
||||
<em>{{ class.summary }}</em>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if node.package is not empty and node.package != '\\' %}
|
||||
===== Package =====
|
||||
{{ node.subpackage ? (node.package ~ '\\' ~ node.subpackage) : node.package }}
|
||||
{% endif %}
|
||||
|
||||
{% for tagName,tags in node.tags if tagName in ['link', 'see'] %}
|
||||
{% if loop.first %}
|
||||
===== See also =====
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
<dd><a href="{{ tag.reference ?: tag.link }}"><div class="namespace-wrapper">{{ tag.description ?: tag.reference }}</div></a></dd>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<h2>Tags</h2>
|
||||
<table class="table table-condensed">
|
||||
{% for tagName,tags in node.tags if tagName not in ['link', 'see', 'package', 'subpackage'] %}
|
||||
<tr>
|
||||
<th>
|
||||
{{ tagName }}
|
||||
</th>
|
||||
<td>
|
||||
{% for tag in tags %}
|
||||
{{ tag.description|markdown|raw }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="2"><em>None found</em></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
{% if node.constants|length > 0 %}
|
||||
<div class="row-fluid">
|
||||
<section class="span8 content file">
|
||||
<h2>Constants</h2>
|
||||
</section>
|
||||
<aside class="span4 detailsbar"></aside>
|
||||
</div>
|
||||
|
||||
{% for constant in node.constants %}
|
||||
{{ block('constant') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if node.functions|length > 0 %}
|
||||
<div class="row-fluid">
|
||||
<section class="span8 content file">
|
||||
<h2>Functions</h2>
|
||||
</section>
|
||||
<aside class="span4 detailsbar"></aside>
|
||||
</div>
|
||||
|
||||
{% for method in node.functions %}
|
||||
{{ block('method') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="source-view-label">{{ node.file.name }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre data-src="{{ path('files/' ~ node.path ~ '.txt')|raw }}" class="language-php line-numbers"></pre>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
42
.doc/phpdoc-templates/combodo-wiki/graphs/class.html.twig
Normal file
42
.doc/phpdoc-templates/combodo-wiki/graphs/class.html.twig
Normal file
@@ -0,0 +1,42 @@
|
||||
{% extends 'layout.html.twig' %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link href="{{ path('css/jquery.iviewer.css') }}" rel="stylesheet" media="all"/>
|
||||
<style>
|
||||
#viewer {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script src="{{ path('js/jquery.mousewheel.js') }}" type="text/javascript"></script>
|
||||
<script src="{{ path('js/jquery.iviewer.js') }}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(window).resize(function(){
|
||||
$("#viewer").height($(window).height() - 100);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#viewer").iviewer({src: '{{ path('graphs/classes.svg') }}', zoom_animation: false});
|
||||
$('#viewer img').bind('dragstart', function(event){
|
||||
event.preventDefault();
|
||||
});
|
||||
$(window).resize();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="wrapper">
|
||||
<div id="viewer" class="viewer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
5
.doc/phpdoc-templates/combodo-wiki/htaccess.dist
Normal file
5
.doc/phpdoc-templates/combodo-wiki/htaccess.dist
Normal file
@@ -0,0 +1,5 @@
|
||||
# Fixes a vulnerability in CentOS: http://stackoverflow.com/questions/20533279/prevent-php-from-parsing-non-php-files-such-as-somefile-php-txt
|
||||
<FilesMatch \.php\.txt$>
|
||||
RemoveHandler .php
|
||||
ForceType text/plain
|
||||
</FilesMatch>
|
||||
@@ -0,0 +1,34 @@
|
||||
{% if title_level is not defined %}
|
||||
{%- set title_level = '==' -%}
|
||||
{% endif %}
|
||||
|
||||
{% if sub_title_level is not defined %}
|
||||
{%- set sub_title_level = title_level|slice(1) -%}
|
||||
{% endif %}
|
||||
{% if sub_title_level == '=' %}
|
||||
{%- set sub_title_level = '' -%}
|
||||
{% endif %}
|
||||
|
||||
{#{% for tagName,tags in structure.tags if tagName in ['code-example'] %}#}
|
||||
{#{% if loop.first %}#}
|
||||
{#{{title_level}} Examples {{title_level}}#}
|
||||
{#{% endif %}#}
|
||||
{#{% for tag in tags %}#}
|
||||
{#{%- set descToken = tag.description|split("\n", 2) -%}#}
|
||||
{#{%- set title = descToken[0] -%}#}
|
||||
{#{%- set code = descToken[1] -%}#}
|
||||
{#{{sub_title_level}} {{ title }} {{sub_title_level}}#}
|
||||
{#<code php>{{ code|raw }}</code>#}
|
||||
{#{% endfor %}#}
|
||||
{#{% endfor %}#}
|
||||
|
||||
|
||||
{% for tagName,tags in structure.tags if tagName in ['example'] %}
|
||||
{% if loop.first %}
|
||||
{{title_level}} Examples {{title_level}}
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
{{ sub_title_level }} {{ tag.filePath|escape }}{{ sub_title_level }}
|
||||
<code php>{{ tag.description|raw }}</code>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% if title_level is not defined %}
|
||||
{% set title_level='' %}
|
||||
{% endif %}
|
||||
|
||||
{% if (node.parent is null) %}
|
||||
{{title_level}} File {{ structure.path }} {{title_level}}
|
||||
{% endif %}
|
||||
|
||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}
|
||||
{{title_level}} Inherited from {{title_level}}
|
||||
[[{{structure.parent}}|{{structure.parent}}]]
|
||||
{% endif %}
|
||||
@@ -0,0 +1,26 @@
|
||||
{% for structure in structures|sort_asc if structure.tags['internal'] is not defined and (structure.tags['api'] is defined or structure.tags['api-advanced'] is defined or structure.tags['overwritable-hook'] is defined or structure.tags['extension-hook'] is defined ) %}
|
||||
{#{{ structure|raw }}#}
|
||||
|
||||
{% set structureName = structure|trim('\\', 'left') %}
|
||||
|
||||
<WRAP group box>
|
||||
<WRAP twothirds column >
|
||||
==== {{ structureName }} ====
|
||||
</WRAP>{# twothirds column#}
|
||||
|
||||
<WRAP third column>
|
||||
{% if structure.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
||||
{% if structure.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
||||
{% if structure.final %}<wrap notice>final</wrap>{% endif %}
|
||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
||||
{% include 'includes/wrap-tags.txt.twig' with {structure:structure, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
||||
</WRAP>{# third column#}
|
||||
|
||||
|
||||
{{ structure.summary|raw }}
|
||||
[[{{structureName}}|More informations]]
|
||||
|
||||
</WRAP>{# group #}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{% if title_level is not defined %}
|
||||
{%- set title_level='==' -%}
|
||||
{% endif %}
|
||||
{% for tagName,tags in structure.tags if tagName in ['link', 'see'] %}
|
||||
{% if loop.first %}
|
||||
{{title_level}} See also {{title_level}}
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
{%- set linkTag = tag.reference|trim('\\', 'left') -%}
|
||||
{% if not('()' in linkTag or '$' in linkTag or node.name in linkTag or '::' in linkTag ) %}
|
||||
{%- set linkTag = linkTag|lower -%}
|
||||
{% elseif node.name~'::' in linkTag %}
|
||||
{%- set linkTag = linkTag|replace({(node.name~'::'): '#'})|lower -%}
|
||||
{% elseif '::' in linkTag -%}
|
||||
{%- set linkTag = linkTag|replace({'::': '#'})|lower -%}
|
||||
{% else %}
|
||||
{%- set linkTag = '#' ~ linkTag|lower -%}
|
||||
{%- endif %}
|
||||
|
||||
{% if loop.length > 1 %} * {% endif %}{% if tag.reference is not empty -%}
|
||||
[[{{linkTag}}|{{ (tag.reference)|trim('\\', 'left') }}]] {% if tag.description|trim is not empty %}: {{ tag.description|trim('\\', 'left') }} {% endif %}
|
||||
{%- else -%}
|
||||
{#{{ tag.description|trim('\\', 'left') }}#}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,56 @@
|
||||
{% if tag is not defined -%}
|
||||
{# Do not display @api if @api-advanced is also present #}
|
||||
{%- set tag = "api" -%}
|
||||
{%- endif %}
|
||||
|
||||
{% if hidden_by is not defined -%}
|
||||
{# Do not display @api if @api-advanced is also present #}
|
||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
||||
{%- endif %}
|
||||
|
||||
|
||||
|
||||
{% for method in methods|sort_asc
|
||||
if (method.visibility == 'public')
|
||||
and (
|
||||
method.tags[tag] is defined
|
||||
and (
|
||||
hidden_by[tag] is not defined or method.tags[hidden_by[tag]] is not defined
|
||||
)
|
||||
)
|
||||
%}
|
||||
{%- if loop.first %}
|
||||
{% if tag == 'api' %}
|
||||
===== API synthesis =====
|
||||
<WRAP>
|
||||
List of the public API methods.
|
||||
When manipulating {{ node.name }}, You can call those methods:
|
||||
</WRAP>
|
||||
{% elseif tag == 'api-advanced' %}
|
||||
===== Advanced API synthesis =====
|
||||
<WRAP>
|
||||
List of advanced API methods
|
||||
Beware they usage is recommended to advanced users only.
|
||||
</WRAP>
|
||||
{% elseif tag == 'overwritable-hook' %}
|
||||
===== overwritable-hook synthesis =====
|
||||
<WRAP >When inheriting from {{ node.name }},
|
||||
you can overwrite those methods in order to add custom logic:
|
||||
</WRAP>
|
||||
{% elseif tag == 'extension-hook' %}
|
||||
===== extension-hook synthesis =====
|
||||
<WRAP >
|
||||
When inheriting from {{ node.name }},
|
||||
you can extend the behaviour of iTop by implementing:
|
||||
</WRAP>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% set sanitizedMethod = method|trim('\\', 'left')|replace({(node.name~'::'): ''}) %}
|
||||
{% if '::' in sanitizedMethod -%}
|
||||
{%- if node.tags['phpdoc-tunning-exclude-inherited'] is not defined %}
|
||||
* [[{{sanitizedMethod|replace({'::': '#'})|lower}}|↪{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
||||
{% endif %}
|
||||
{%- else %}
|
||||
* [[#{{sanitizedMethod}}|{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,20 @@
|
||||
{% if title_level is not defined %}
|
||||
{% set title_level = '==' %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{%- for tagName,tags in structure.tags if tagName in tagsWithDescription -%}
|
||||
{%- for tag in tags -%}
|
||||
{%- if tag.description is not empty -%}
|
||||
{%- if WRAP is defined -%}
|
||||
<WRAP {{WRAP}}>
|
||||
{%- endif -%}
|
||||
{{title_level}} {{ tagName }} {{title_level}}
|
||||
{{ tag.description|escape }}
|
||||
{%- if WRAP is defined -%}
|
||||
</WRAP>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endfor -%}
|
||||
|
||||
22
.doc/phpdoc-templates/combodo-wiki/includes/tags.txt.twig
Normal file
22
.doc/phpdoc-templates/combodo-wiki/includes/tags.txt.twig
Normal file
@@ -0,0 +1,22 @@
|
||||
{% if title_level is not defined %}
|
||||
{% set title_level='=====' %}
|
||||
{% endif %}
|
||||
|
||||
{% if blacklist is not defined %}
|
||||
{% set blacklist =['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'api', 'api-advanced', 'todo', 'code-example'] %}
|
||||
{% endif %}
|
||||
{% if hidden_by is not defined -%}
|
||||
{# Do not display @api if @api-advanced is also present #}
|
||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
||||
{%- endif %}
|
||||
|
||||
{#^ {% for tagName,tags in structure.tags if tagName not in blacklist -%}#}
|
||||
{#{{ tagName }} ^#}
|
||||
{#{%- endfor %}#}
|
||||
|
||||
{% for tagName,tags in structure.tags if tagName not in blacklist and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
||||
{%- if loop.first %}
|
||||
{{title_level}} Tags {{title_level}}
|
||||
{% endif %}
|
||||
^ {{ tagName }} | {% for tag in tags %}{{ tag.version ? tag.version ~ ' ' : '' }}{{ tag.description}}{% endfor %} |
|
||||
{% endfor %}
|
||||
24
.doc/phpdoc-templates/combodo-wiki/includes/used-by.txt.twig
Normal file
24
.doc/phpdoc-templates/combodo-wiki/includes/used-by.txt.twig
Normal file
@@ -0,0 +1,24 @@
|
||||
{% if title_level is not defined %}
|
||||
{% set title_level='' %}
|
||||
{% endif %}
|
||||
{% for tagName,tags in structure.tags if tagName in ['used-by'] %}
|
||||
{% if loop.first %}
|
||||
{{title_level}} Used by {{title_level}}
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
||||
{#{% if loop.first %}#}
|
||||
{#<dt>Uses</dt>#}
|
||||
{#{% endif %}#}
|
||||
{#{% for tag in tags %}#}
|
||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
||||
{#{% endfor %}#}
|
||||
{#{% endfor %}#}
|
||||
24
.doc/phpdoc-templates/combodo-wiki/includes/uses.txt.twig
Normal file
24
.doc/phpdoc-templates/combodo-wiki/includes/uses.txt.twig
Normal file
@@ -0,0 +1,24 @@
|
||||
{% if title_level is not defined %}
|
||||
{% set title_level='' %}
|
||||
{% endif %}
|
||||
{% for tagName,tags in structure.tags if tagName in ['uses'] %}
|
||||
{% if loop.first %}
|
||||
{{title_level}} Uses {{title_level}}
|
||||
{% endif %}
|
||||
{% for tag in tags %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
||||
{#{% if loop.first %}#}
|
||||
{#<dt>Uses</dt>#}
|
||||
{#{% endif %}#}
|
||||
{#{% for tag in tags %}#}
|
||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
||||
{#{% endfor %}#}
|
||||
{#{% endfor %}#}
|
||||
@@ -0,0 +1,11 @@
|
||||
{% if wrap is not defined -%}
|
||||
{% set wrap = 'notice' %}
|
||||
{%- endif -%}
|
||||
{% if hidden_by is not defined -%}
|
||||
{# Do not display @api if @api-advanced is also present #}
|
||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
||||
{%- endif %}
|
||||
|
||||
{%- for tagName,tags in structure.tags if tagName in wrapTags and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
||||
<wrap {{wrap}}>{{tagName}}</wrap>
|
||||
{% endfor %}
|
||||
121
.doc/phpdoc-templates/combodo-wiki/interface.txt.twig
Normal file
121
.doc/phpdoc-templates/combodo-wiki/interface.txt.twig
Normal file
@@ -0,0 +1,121 @@
|
||||
{% extends 'layout.txt.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<wrap button>[[start|🔙 Back]]</wrap>
|
||||
|
||||
{% if node.tags['internal'] is defined %}
|
||||
====== {{ node.name }} ======
|
||||
<WRAP alert>This interface is "internal", and thus is not documented!</WRAP>
|
||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
||||
====== {{ node.name }} ======
|
||||
<WRAP alert>This interface is neither "api", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
||||
{% else %}
|
||||
|
||||
====== {{ node.name }} ======
|
||||
|
||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
||||
|
||||
|
||||
|
||||
{% if node.deprecated %}
|
||||
=== **<del>Deprecated</del>**===
|
||||
//{{ node.tags.deprecated[0].description }}//
|
||||
{% endif %}
|
||||
|
||||
|
||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
||||
<html>{{ node.description|markdown|raw }}</html>
|
||||
|
||||
|
||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
||||
|
||||
|
||||
{% set class = node.parent %}
|
||||
{% block hierarchy_element %}
|
||||
|
||||
{% if class and class.name is defined and class.name|trim != '' %}
|
||||
==== parent ====
|
||||
{% set child = class %}
|
||||
{% set class = class.parent %}
|
||||
{{ block('hierarchy_element') }}
|
||||
[[{{ child.name }}|{{ child.name }}]]
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% for interface in node.interfaces|sort_asc %}
|
||||
{% if loop.first %}
|
||||
==== Implements ====
|
||||
{% endif %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for trait in node.usedTraits|sort_asc %}
|
||||
{% if loop.first %}
|
||||
==== Uses traits ====
|
||||
{% endif %}
|
||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
||||
|
||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tunning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
||||
|
||||
|
||||
{% set methods = node.inheritedMethods.merge(node.methods) %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
||||
|
||||
<WRAP clear />
|
||||
|
||||
|
||||
{% for method in methods|sort_asc if method.visibility == 'public' %}
|
||||
{%- if loop.first %}
|
||||
===== Public methods =====
|
||||
{% endif %}
|
||||
{{ block('method') }}
|
||||
{% endfor %}
|
||||
{% for method in methods|sort_asc if method.visibility == 'protected' %}
|
||||
{%- if loop.first %}
|
||||
===== Protected methods =====
|
||||
{% endif %}
|
||||
{{ block('method') }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
||||
{% if constants|length > 0 %}
|
||||
===== Constants =====
|
||||
{% for constant in constants|sort_asc %}
|
||||
{{ block('constant') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{#{% set properties = node.inheritedProperties.merge(node.properties) %}#}
|
||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
||||
{#{%- if loop.first %}#}
|
||||
{#===== Public properties =====#}
|
||||
{#{% endif %}#}
|
||||
{#{{ block('property') }}#}
|
||||
{#{% endfor %}#}
|
||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
||||
{#{%- if loop.first %}#}
|
||||
{#===== Protected properties =====#}
|
||||
{#{% endif %}#}
|
||||
{#{{ block('property') }}#}
|
||||
{#{% endfor %}#}
|
||||
|
||||
|
||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
||||
|
||||
<wrap button>[[start|🔙 Back]]</wrap>
|
||||
{% endblock %}
|
||||
5
.doc/phpdoc-templates/combodo-wiki/layout.txt.twig
Normal file
5
.doc/phpdoc-templates/combodo-wiki/layout.txt.twig
Normal file
@@ -0,0 +1,5 @@
|
||||
{% use 'elements/constant.txt.twig' %}
|
||||
{% use 'elements/property.txt.twig' %}
|
||||
{% use 'elements/method.txt.twig' %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
51
.doc/phpdoc-templates/combodo-wiki/namespace.txt.twig
Normal file
51
.doc/phpdoc-templates/combodo-wiki/namespace.txt.twig
Normal file
@@ -0,0 +1,51 @@
|
||||
{% extends 'layout.txt.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% set namespace = project.namespace %}
|
||||
{{ block('sidebarNamespaces') }}
|
||||
|
||||
{#{{ node.parent|raw }}#}
|
||||
{#====== {{ node.parent.fullyQualifiedStructuralElementName }}{{ node.name }} ======#}
|
||||
|
||||
{% if node.children|length > 0 %}
|
||||
=====Namespaces=====
|
||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.children} %}
|
||||
----
|
||||
{% endif %}
|
||||
|
||||
{% if node.traits|length > 0 %}
|
||||
===== Traits =====
|
||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.traits} %}
|
||||
----
|
||||
{%- endif %}
|
||||
|
||||
{% if node.interfaces|length > 0 %}
|
||||
===== Interfaces =====
|
||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.interfaces} %}
|
||||
----
|
||||
{% endif %}
|
||||
|
||||
{% if node.classes|length > 0 %}
|
||||
===== Classes =====
|
||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.classes} %}
|
||||
----
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{#{% if node.constants|length > 0 %}#}
|
||||
{#===== Constants =====#}
|
||||
{#{% for constant in node.constants|sort_asc %}#}
|
||||
{# {{ block('constant') }}#}
|
||||
{#{% endfor %}#}
|
||||
{#{% endif %}#}
|
||||
|
||||
{#{% if node.functions|length > 0 %}#}
|
||||
{#===== Functions =====#}
|
||||
|
||||
{#{% for method in node.functions|sort_asc %}#}
|
||||
{# {{ block('method') }}#}
|
||||
{#{% endfor %}#}
|
||||
{#{% endif %}#}
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
====== Deprecated elements ======
|
||||
|
||||
{#{% for element in project.indexes.elements if element.deprecated %}#}
|
||||
{#{% if element.file.path != previousPath %}#}
|
||||
{#<li><a href="#{{ element.file.path }}"><i class="icon-file"></i> {{ element.file.path }}</a></li>#}
|
||||
{#{% endif %}#}
|
||||
{#{% set previousPath = element.file.path %}#}
|
||||
{#{% endfor %}#}
|
||||
|
||||
{% for element in project.indexes.elements if element.deprecated %}
|
||||
{% if element.file.path != previousPath %}
|
||||
{% if previousPath %}
|
||||
</WRAP>{# group #}
|
||||
{% endif %}
|
||||
{#<a name="{{ element.file.path }}" id="{{ element.file.path }}"></a>#}
|
||||
===== {{ element.file.path }} ({{ element.tags.deprecated.count }} found)=====
|
||||
|
||||
<WRAP group >
|
||||
<WRAP third column >
|
||||
Element
|
||||
</WRAP>{# third column#}
|
||||
<WRAP third column >
|
||||
Line
|
||||
</WRAP>{# third column#}
|
||||
<WRAP third column >
|
||||
Description
|
||||
</WRAP>{# third column#}
|
||||
|
||||
{% endif %}
|
||||
{% for tag in element.tags.deprecated %}
|
||||
<WRAP group >
|
||||
<WRAP third column >
|
||||
{{ element.fullyQualifiedStructuralElementName }}
|
||||
</WRAP>{# third column#}
|
||||
<WRAP third column >
|
||||
{{ element.line }}
|
||||
</WRAP>{# third column#}
|
||||
<WRAP third column >
|
||||
{{ tag.description }}
|
||||
</WRAP>{# third column#}
|
||||
|
||||
{% endfor %}
|
||||
</WRAP>{# group #}
|
||||
{% set previousPath = element.file.path %}
|
||||
{% else %}
|
||||
<WRAP info>No deprecated elements have been found in this project.</WRAP>
|
||||
{% endfor %}
|
||||
|
||||
27
.doc/phpdoc-templates/combodo-wiki/template.xml
Normal file
27
.doc/phpdoc-templates/combodo-wiki/template.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<template>
|
||||
<author>Bruno DA SILVA</author>
|
||||
<email>contact [at] combodo.com</email>
|
||||
<version>1.0.0</version>
|
||||
<copyright>Combodo 2018</copyright>
|
||||
<description><![CDATA[
|
||||
|
||||
Forked from the clean theme of https://github.com/phpDocumentor/phpDocumentor2 provided under the MIT licence.
|
||||
The original work is copyright "Mike van Riel".
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
To improve performance you can add the following to your .htaccess:
|
||||
|
||||
<ifModule mod_deflate.c>
|
||||
<filesMatch "\.(js|css|html)$">
|
||||
SetOutputFilter DEFLATE
|
||||
</filesMatch>
|
||||
</ifModule>
|
||||
]]></description>
|
||||
<transformations>
|
||||
<transformation writer="twig" query="namespace" source="templates/combodo-wiki/namespace.txt.twig" artifact="start.txt"/>
|
||||
<transformation writer="twig" query="indexes.classes" source="templates/combodo-wiki/class.txt.twig" artifact="{{name}}.txt"/>
|
||||
<transformation writer="twig" query="indexes.interfaces" source="templates/combodo-wiki/interface.txt.twig" artifact="{{name}}.txt" />
|
||||
</transformations>
|
||||
</template>
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -38,7 +38,8 @@ test/vendor/*
|
||||
!/.idea/inspectionProfiles
|
||||
!/.idea/inspectionProfiles/*
|
||||
|
||||
|
||||
#phpdocumentor temp file
|
||||
ast.dump
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
@@ -365,7 +365,7 @@ interface iPopupMenuExtension
|
||||
* Base class for the various types of custom menus
|
||||
*
|
||||
* @package Extensibility
|
||||
* @internal
|
||||
* @api
|
||||
* @since 2.0
|
||||
*/
|
||||
abstract class ApplicationPopupMenuItem
|
||||
@@ -379,6 +379,8 @@ abstract class ApplicationPopupMenuItem
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param string $sUID The unique identifier of this menu in iTop... make sure you pass something unique enough
|
||||
* @param string $sLabel The display label of the menu (must be localized)
|
||||
@@ -509,6 +511,9 @@ class JSPopupMenuItem extends ApplicationPopupMenuItem
|
||||
|
||||
/**
|
||||
* Class for adding an item that triggers some Javascript code
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param string $sUID The unique identifier of this menu in iTop... make sure you pass something unique enough
|
||||
* @param string $sLabel The display label of the menu (must be localized)
|
||||
* @param string $sJSCode In case the menu consists in executing some havascript code inside the page, pass it here. If supplied $sURL ans $sTarget will be ignored
|
||||
|
||||
3054
composer.lock
generated
Normal file
3054
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7849,6 +7849,87 @@ class AttributeStopWatch extends AttributeDefinition
|
||||
throw new CoreException("Unknown item code '$sItemCode' for attribute ".$this->GetHostClass().'::'.$this->GetCode());
|
||||
}
|
||||
|
||||
|
||||
public function GetSubItemSearchType($sItemCode)
|
||||
{
|
||||
switch ($sItemCode)
|
||||
{
|
||||
case 'timespent':
|
||||
return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds
|
||||
case 'started':
|
||||
case 'laststart':
|
||||
case 'stopped':
|
||||
return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp
|
||||
}
|
||||
|
||||
foreach($this->ListThresholds() as $iThreshold => $aFoo)
|
||||
{
|
||||
$sThPrefix = $iThreshold.'_';
|
||||
if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix)
|
||||
{
|
||||
// The current threshold is concerned
|
||||
$sThresholdCode = substr($sItemCode, strlen($sThPrefix));
|
||||
switch ($sThresholdCode)
|
||||
{
|
||||
case 'deadline':
|
||||
return static::SEARCH_WIDGET_TYPE_DATE_TIME; //timestamp
|
||||
case 'passed':
|
||||
case 'triggered':
|
||||
return static::SEARCH_WIDGET_TYPE_ENUM; //booleans, used in conjuction with GetSubItemAllowedValues and IsSubItemNullAllowed
|
||||
case 'overrun':
|
||||
return static::SEARCH_WIDGET_TYPE_NUMERIC; //seconds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return static::SEARCH_WIDGET_TYPE_RAW;
|
||||
}
|
||||
|
||||
public function GetSubItemAllowedValues($sItemCode, $aArgs = array(), $sContains = '')
|
||||
{
|
||||
foreach($this->ListThresholds() as $iThreshold => $aFoo)
|
||||
{
|
||||
$sThPrefix = $iThreshold.'_';
|
||||
if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix)
|
||||
{
|
||||
// The current threshold is concerned
|
||||
$sThresholdCode = substr($sItemCode, strlen($sThPrefix));
|
||||
switch ($sThresholdCode)
|
||||
{
|
||||
case 'passed':
|
||||
case 'triggered':
|
||||
return array(
|
||||
0 => $this->GetBooleanLabel(0),
|
||||
1 => $this->GetBooleanLabel(1),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function IsSubItemNullAllowed($sItemCode, $bDefaultValue)
|
||||
{
|
||||
foreach($this->ListThresholds() as $iThreshold => $aFoo)
|
||||
{
|
||||
$sThPrefix = $iThreshold.'_';
|
||||
if (substr($sItemCode, 0, strlen($sThPrefix)) == $sThPrefix)
|
||||
{
|
||||
// The current threshold is concerned
|
||||
$sThresholdCode = substr($sItemCode, strlen($sThPrefix));
|
||||
switch ($sThresholdCode)
|
||||
{
|
||||
case 'passed':
|
||||
case 'triggered':
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $bDefaultValue;
|
||||
}
|
||||
|
||||
protected function GetBooleanLabel($bValue)
|
||||
{
|
||||
$sDictKey = $bValue ? 'yes' : 'no';
|
||||
@@ -8198,7 +8279,37 @@ class AttributeStopWatch extends AttributeDefinition
|
||||
*/
|
||||
class AttributeSubItem extends AttributeDefinition
|
||||
{
|
||||
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW;
|
||||
/**
|
||||
* Return the search widget type corresponding to this attribute
|
||||
* the computation is made by AttributeStopWatch::GetSubItemSearchType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetSearchType()
|
||||
{
|
||||
/** @var AttributeStopWatch $oParent */
|
||||
$oParent = $this->GetTargetAttDef();
|
||||
|
||||
return $oParent->GetSubItemSearchType($this->Get('item_code'));
|
||||
}
|
||||
|
||||
public function GetAllowedValues($aArgs = array(), $sContains = '')
|
||||
{
|
||||
/** @var AttributeStopWatch $oParent */
|
||||
$oParent = $this->GetTargetAttDef();
|
||||
|
||||
return $oParent->GetSubItemAllowedValues($this->Get('item_code'), $aArgs, $sContains);
|
||||
}
|
||||
|
||||
public function IsNullAllowed()
|
||||
{
|
||||
/** @var AttributeStopWatch $oParent */
|
||||
$oParent = $this->GetTargetAttDef();
|
||||
|
||||
$bDefaultValue = parent::IsNullAllowed();
|
||||
|
||||
return $oParent->IsSubItemNullAllowed($this->Get('item_code'), $bDefaultValue);
|
||||
}
|
||||
|
||||
static public function ListExpectedParams()
|
||||
{
|
||||
|
||||
@@ -696,6 +696,8 @@ abstract class CMDBObject extends DBObject
|
||||
* TODO: investigate how to get rid of this class that was made to workaround some language limitation... or a poor design!
|
||||
*
|
||||
* @package iTopORM
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CMDBObjectSet extends DBObjectSet
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,9 +17,22 @@
|
||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
//
|
||||
|
||||
// Dev hack for disabling the some query build optimizations (Folding/Merging)
|
||||
/** @internal Dev hack for disabling some query build optimizations (Folding/Merging) */
|
||||
define('ENABLE_OPT', true);
|
||||
|
||||
/**
|
||||
* A search over a DBObject
|
||||
*
|
||||
* This is the most common search cases, the other class representing a search is DBUnionSearch.
|
||||
* For clarity purpose, since only the constructor vary between DBObjectSearch and DBUnionSearch, all the API is documented on the common ancestor: DBSearch
|
||||
* Please refer to DBSearch's documentation
|
||||
*
|
||||
* @package iTopORM
|
||||
* @phpdoc-tunning-exclude-inherited this tag prevent PHPdoc from displaying inherited methods. This is done in order to force the API doc. location into DBSearch only.
|
||||
* @api
|
||||
* @see DBSearch
|
||||
* @see DBUnionSearch
|
||||
*/
|
||||
class DBObjectSearch extends DBSearch
|
||||
{
|
||||
private $m_aClasses; // queried classes (alias => class name), the first item is the class corresponding to this filter (the rest is coming from subfilters)
|
||||
@@ -29,11 +42,23 @@ class DBObjectSearch extends DBSearch
|
||||
private $m_aPointingTo;
|
||||
private $m_aReferencedBy;
|
||||
|
||||
// By default, some information may be hidden to the current user
|
||||
// But it may happen that we need to disable that feature
|
||||
/**
|
||||
* @var bool whether or not some information should be hidden to the current user. Default to false == hide information.
|
||||
* @see AllowAllData()
|
||||
*/
|
||||
protected $m_bAllowAllData = false;
|
||||
protected $m_bDataFiltered = false;
|
||||
|
||||
/**
|
||||
* DBObjectSearch constructor.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param string $sClass
|
||||
* @param string|null $sClassAlias
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($sClass, $sClassAlias = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -27,9 +27,13 @@ require_once('dbobjectiterator.php');
|
||||
|
||||
|
||||
/**
|
||||
* A set of persistent objects, could be heterogeneous as long as the objects in the set have a common ancestor class
|
||||
* A set of persistent objects
|
||||
*
|
||||
* Created against a DBObjectSearch with additional information not relevant for the DBObjectSearch (ie: order, limit, ...)
|
||||
* This set could be heterogeneous as long as the objects in the set have a common ancestor class.
|
||||
*
|
||||
* @package iTopORM
|
||||
* @api
|
||||
*/
|
||||
class DBObjectSet implements iDBObjectSetIterator
|
||||
{
|
||||
@@ -82,6 +86,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Create a new set based on a Search definition.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param DBSearch $oFilter The search filter defining the objects which are part of the set (multiple columns/objects per row are supported)
|
||||
* @param array $aOrderBy Array of '[<classalias>.]attcode' => bAscending
|
||||
* @param array $aArgs Values to substitute for the search/query parameters (if any). Format: param_name => value
|
||||
@@ -110,6 +116,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
$this->m_oSQLResult = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (is_object($this->m_oSQLResult))
|
||||
@@ -119,6 +128,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
@@ -145,6 +156,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->m_oFilter = $this->m_oFilter->DeepClone();
|
||||
@@ -158,6 +172,7 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
|
||||
/**
|
||||
* Called when unserializing a DBObjectSet
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
@@ -168,18 +183,30 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
$this->m_oSQLResult = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $bShow
|
||||
*/
|
||||
public function SetShowObsoleteData($bShow)
|
||||
{
|
||||
$this->m_oFilter->SetShowObsoleteData($bShow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return bool
|
||||
*/
|
||||
public function GetShowObsoleteData()
|
||||
{
|
||||
return $this->m_oFilter->GetShowObsoleteData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
|
||||
* Specify the subset of attributes to load
|
||||
* this subset is specified for each class of objects,
|
||||
* this has to be done before the actual fetch.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param array $aAttToLoad Format: alias => array of attribute_codes
|
||||
*
|
||||
@@ -262,6 +289,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Create a set (in-memory) containing just the given object
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param \DBobject $oObject
|
||||
*
|
||||
* @return \DBObjectSet The singleton set
|
||||
@@ -278,6 +307,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Create an empty set (in-memory), for the given class (and its subclasses) of objects
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $sClass The class (or an ancestor) for the objects to be added in this set
|
||||
*
|
||||
* @return \DBObjectSet The empty set
|
||||
@@ -297,6 +328,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Create a set (in-memory) with just one column (i.e. one object per row) and filled with the given array of objects
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $sClass The class of the objects (must be a common ancestor to all objects in the set)
|
||||
* @param array $aObjects The list of objects to add into the set
|
||||
*
|
||||
@@ -314,9 +347,11 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Create a set in-memory with several classes of objects per row (with one alias per "column")
|
||||
*
|
||||
* Limitation:
|
||||
* **Limitation:**
|
||||
* The filter/OQL query representing such a set can not be rebuilt (only the first column will be taken into account)
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array $aClasses Format: array of (alias => class)
|
||||
* @param array $aObjects Format: array of (array of (classalias => object))
|
||||
*
|
||||
@@ -345,6 +380,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param $oObject
|
||||
* @param string $sLinkSetAttCode
|
||||
* @param string $sExtKeyToRemote
|
||||
@@ -371,11 +409,15 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all as array of DBObject
|
||||
*
|
||||
* Note: After calling this method, the set cursor will be at the end of the set. You might want to rewind it.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param bool $bWithId
|
||||
*
|
||||
* @return array
|
||||
* @return DBObject[]
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
@@ -401,7 +443,14 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* Fetch all as a structured array
|
||||
*
|
||||
* Unlike ToArray, ToArrayOfValues return the objects as an array.
|
||||
* Only the scalar values will be presents (see AttributeDefinition::IsScalar())
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @return array[]
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
@@ -773,6 +822,7 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
* May actually perform the SQL query SELECT COUNT... if the set was not previously loaded, or loaded with a
|
||||
* SetLimit
|
||||
*
|
||||
* @api
|
||||
* @return int The total number of rows for this set.
|
||||
*
|
||||
* @throws \CoreException
|
||||
@@ -796,7 +846,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
return $this->m_iNumTotalDBRows + count($this->m_aAddedObjects); // Does it fix Trac #887 ??
|
||||
}
|
||||
|
||||
/** Check if the count exceeds a given limit
|
||||
/**
|
||||
* Check if the count exceeds a given limit
|
||||
*
|
||||
* @param $iLimit
|
||||
*
|
||||
* @return bool
|
||||
@@ -831,7 +883,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
return ($iCount > $iLimit);
|
||||
}
|
||||
|
||||
/** Count only up to the given limit
|
||||
/**
|
||||
* Count only up to the given limit
|
||||
*
|
||||
* @param $iLimit
|
||||
*
|
||||
* @return int
|
||||
@@ -877,9 +931,11 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the object (with the given class alias) at the current position in the set and move the cursor to the next position.
|
||||
* Fetch an object (with the given class alias) at the current position in the set and move the cursor to the next position.
|
||||
*
|
||||
* @param string $sRequestedClassAlias The class alias to fetch (if there are several objects/classes per row)
|
||||
* @api
|
||||
*
|
||||
* @param string $sRequestedClassAlias The class alias to fetch (defaults to the first selected class)
|
||||
*
|
||||
* @return \DBObject The fetched object or null when at the end
|
||||
*
|
||||
@@ -933,6 +989,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Fetch the whole row of objects (if several classes have been specified in the query) and move the cursor to the next position
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @return array An associative with the format 'classAlias' => $oObj representing the current row of the set. Returns null when at the end.
|
||||
*
|
||||
* @throws \CoreException
|
||||
@@ -982,6 +1040,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
/**
|
||||
* Position the cursor (for iterating in the set) to the first position (equivalent to Seek(0))
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Rewind()
|
||||
@@ -1445,6 +1505,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
|
||||
/**
|
||||
* Helper function to perform a custom sort of a hash array
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function HashCountComparison($a, $b) // Sort descending on 'count'
|
||||
{
|
||||
@@ -1464,6 +1526,11 @@ function HashCountComparison($a, $b) // Sort descending on 'count'
|
||||
* LIMITATIONS:
|
||||
* - only DBObjectSets with one column (i.e. one class of object selected) are supported
|
||||
* - the first set must be the one loaded from the database
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @package iTopORM
|
||||
*
|
||||
*/
|
||||
class DBObjectSetComparator
|
||||
{
|
||||
@@ -1508,6 +1575,8 @@ class DBObjectSetComparator
|
||||
/**
|
||||
* Builds the lists of fingerprints and initializes internal structures, if it was not already done
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function ComputeFingerprints()
|
||||
@@ -1557,6 +1626,9 @@ class DBObjectSetComparator
|
||||
|
||||
/**
|
||||
* Tells if the sets are equivalent or not. Returns as soon as the first difference is found.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return boolean true if the set have an equivalent content, false otherwise
|
||||
*
|
||||
* @throws \CoreException
|
||||
@@ -1603,8 +1675,10 @@ class DBObjectSetComparator
|
||||
/**
|
||||
* Get the list of differences between the two sets. In ordeer to write back into the database only the minimum changes
|
||||
* THE FIRST SET MUST BE THE ONE LOADED FROM THE DATABASE
|
||||
* Returns a hash: 'added' => DBObject(s), 'removed' => DBObject(s), 'modified' => DBObjects(s)
|
||||
* @return array
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return array 'added' => DBObject(s), 'removed' => DBObject(s), 'modified' => DBObjects(s)
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
@@ -1659,7 +1733,9 @@ class DBObjectSetComparator
|
||||
}
|
||||
|
||||
/**
|
||||
* Helpr to clone (in memory) an object and to apply to it the values taken from a second object
|
||||
* Helper to clone (in memory) an object and to apply to it the values taken from a second object
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param \DBObject $oObjToClone
|
||||
* @param \DBObject $oObjWithValues
|
||||
|
||||
@@ -23,23 +23,34 @@ require_once('dbunionsearch.class.php');
|
||||
/**
|
||||
* An object search
|
||||
*
|
||||
* DBSearch provides an API that leverage the possibility to construct a search against iTop's persisted objects.
|
||||
* In order to do so, it let you declare the classes you want to fetch, the conditions you want to apply, ...
|
||||
*
|
||||
* Note: in the ancient times of iTop, a search was named after DBObjectSearch.
|
||||
* When the UNION has been introduced, it has been decided to:
|
||||
* - declare a hierarchy of search classes, with two leafs :
|
||||
* - one class to cope with a single query (A JOIN B... WHERE...)
|
||||
* - and the other to cope with several queries (query1 UNION query2)
|
||||
* - in order to preserve forward/backward compatibility of the existing modules
|
||||
* - keep the name of DBObjectSearch even if it a little bit confusing
|
||||
* - do not provide a type-hint for function parameters defined in the modules
|
||||
* - leave the statements DBObjectSearch::FromOQL in the modules, though DBSearch is more relevant
|
||||
* * declare a hierarchy of search classes : `DBObjectSearch` & `DBUnionSearch`
|
||||
* * DBObjectSearch cope with single query (A JOIN B... WHERE...)
|
||||
* * DBUnionSearch cope with several queries (query1 UNION query2)
|
||||
* * in order to preserve forward/backward compatibility of the existing modules
|
||||
* * keep the name of DBObjectSearch even if it a little bit confusing
|
||||
* * do not provide a type-hint for function parameters defined in the modules
|
||||
* * leave the statements DBObjectSearch::FromOQL in the modules, though DBSearch is more relevant
|
||||
*
|
||||
* @copyright Copyright (C) 2015-2017 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*
|
||||
*
|
||||
* @package iTopORM
|
||||
* @api
|
||||
* @see DBObjectSearch::__construct()
|
||||
* @see DBUnionSearch::__construct()
|
||||
*/
|
||||
|
||||
abstract class DBSearch
|
||||
{
|
||||
/** @internal */
|
||||
const JOIN_POINTING_TO = 0;
|
||||
/** @internal */
|
||||
const JOIN_REFERENCED_BY = 1;
|
||||
|
||||
protected $m_bNoContextParameters = false;
|
||||
@@ -47,20 +58,31 @@ abstract class DBSearch
|
||||
protected $m_bArchiveMode = false;
|
||||
protected $m_bShowObsoleteData = true;
|
||||
|
||||
/**
|
||||
* DBSearch constructor.
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::FromOQL()
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* called by the constructor
|
||||
* @internal Set the obsolete and archive modes to the default ones
|
||||
*/
|
||||
protected function Init()
|
||||
{
|
||||
// Set the obsolete and archive modes to the default ones
|
||||
$this->m_bArchiveMode = utils::IsArchiveMode();
|
||||
$this->m_bShowObsoleteData = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a deep clone (as opposed to "clone" which does copy a reference to the underlying objects)
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return \DBSearch
|
||||
**/
|
||||
@@ -69,22 +91,62 @@ abstract class DBSearch
|
||||
return unserialize(serialize($this)); // Beware this serializes/unserializes the search and its parameters as well
|
||||
}
|
||||
|
||||
/**
|
||||
* whether or not some information should be hidden to the current user.
|
||||
*
|
||||
* @api
|
||||
* @see IsAllDataAllowed()
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function AllowAllData();
|
||||
|
||||
/**
|
||||
* Current state of AllowAllData
|
||||
*
|
||||
* @internal
|
||||
* @see AllowAllData()
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function IsAllDataAllowed();
|
||||
|
||||
/**
|
||||
* Should the archives be fetched
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param $bEnable
|
||||
*/
|
||||
public function SetArchiveMode($bEnable)
|
||||
{
|
||||
$this->m_bArchiveMode = $bEnable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return bool
|
||||
*/
|
||||
public function GetArchiveMode()
|
||||
{
|
||||
return $this->m_bArchiveMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the obsolete data be fetched
|
||||
*
|
||||
* @internal
|
||||
* @param $bShow
|
||||
*/
|
||||
public function SetShowObsoleteData($bShow)
|
||||
{
|
||||
$this->m_bShowObsoleteData = $bShow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return bool
|
||||
*/
|
||||
public function GetShowObsoleteData()
|
||||
{
|
||||
if ($this->m_bArchiveMode || $this->IsAllDataAllowed())
|
||||
@@ -99,14 +161,36 @@ abstract class DBSearch
|
||||
return $bRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function NoContextParameters() {$this->m_bNoContextParameters = true;}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return bool
|
||||
*/
|
||||
public function HasContextParameters() {return $this->m_bNoContextParameters;}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $sPluginClass
|
||||
* @param $sProperty
|
||||
* @param $value
|
||||
*/
|
||||
public function SetModifierProperty($sPluginClass, $sProperty, $value)
|
||||
{
|
||||
$this->m_aModifierProperties[$sPluginClass][$sProperty] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $sPluginClass
|
||||
*
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function GetModifierProperties($sPluginClass)
|
||||
{
|
||||
if (array_key_exists($sPluginClass, $this->m_aModifierProperties))
|
||||
@@ -119,18 +203,44 @@ abstract class DBSearch
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $sAlias
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetClassName($sAlias);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetClass();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetClassAlias();
|
||||
|
||||
/**
|
||||
* Change the class (only subclasses are supported as of now, because the conditions must fit the new class)
|
||||
* Change the class
|
||||
*
|
||||
* Defaults to the first selected class (most of the time it is also the first joined class
|
||||
* only subclasses are supported as of now, because the conditions must fit the new class
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
abstract public function ChangeClass($sNewClass, $sAlias = null);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetSelectedClasses();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param array $aSelectedClasses array of aliases
|
||||
* @throws CoreException
|
||||
*/
|
||||
@@ -138,6 +248,8 @@ abstract class DBSearch
|
||||
|
||||
/**
|
||||
* Change any alias of the query tree
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param $sOldName
|
||||
* @param $sNewName
|
||||
@@ -145,57 +257,198 @@ abstract class DBSearch
|
||||
*/
|
||||
abstract public function RenameAlias($sOldName, $sNewName);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function IsAny();
|
||||
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function Describe(){return 'deprecated - use ToOQL() instead';}
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function DescribeConditionPointTo($sExtKeyAttCode, $aPointingTo){return 'deprecated - use ToOQL() instead';}
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function DescribeConditionRefBy($sForeignClass, $sForeignExtKeyAttCode){return 'deprecated - use ToOQL() instead';}
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function DescribeConditionRelTo($aRelInfo){return 'deprecated - use ToOQL() instead';}
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function DescribeConditions(){return 'deprecated - use ToOQL() instead';}
|
||||
/**
|
||||
* @deprecated use ToOQL() instead
|
||||
* @internal
|
||||
* @return string
|
||||
*/
|
||||
public function __DescribeHTML(){return 'deprecated - use ToOQL() instead';}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function ResetCondition();
|
||||
|
||||
/**
|
||||
* add $oExpression as a OR
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::AddConditionExpression()
|
||||
*
|
||||
* @param Expression $oExpression
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function MergeConditionExpression($oExpression);
|
||||
|
||||
/**
|
||||
* add $oExpression as a AND
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::MergeConditionExpression()
|
||||
*
|
||||
* @param Expression $oExpression
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function AddConditionExpression($oExpression);
|
||||
|
||||
/**
|
||||
* Condition on the friendlyname
|
||||
*
|
||||
* Restrict the query to only the corresponding selected class' friendlyname
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $sName the desired friendlyname
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function AddNameCondition($sName);
|
||||
|
||||
/**
|
||||
* Add a condition
|
||||
*
|
||||
* This is the simplest way to express a AND condition. For complex use cases, use MergeConditionExpression or AddConditionExpression instead
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param string $sFilterCode
|
||||
* @param mixed $value
|
||||
* @param string $sOpCode operator to use : '=' (default), '!=', 'IN', 'NOT IN'
|
||||
*
|
||||
* @throws \CoreException
|
||||
*
|
||||
*/
|
||||
abstract public function AddCondition($sFilterCode, $value, $sOpCode = null);
|
||||
/**
|
||||
* Specify a condition on external keys or link sets
|
||||
* @param sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param string $sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively
|
||||
* Example: infra_list->ci_id->location_id->country
|
||||
* @param value The value to match (can be an array => IN(val1, val2...)
|
||||
* @param mixed $value The value to match (can be an array => IN(val1, val2...)
|
||||
* @return void
|
||||
*/
|
||||
abstract public function AddConditionAdvanced($sAttSpec, $value);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param string $sFullText
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function AddCondition_FullText($sFullText);
|
||||
|
||||
/**
|
||||
* Perform a join, the remote class being matched by the mean of its primary key
|
||||
*
|
||||
* The join is performed
|
||||
* * from the searched class, based on the $sExtKeyAttCode attribute
|
||||
* * against the oFilter searched class, based on its primary key
|
||||
* Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class.
|
||||
*
|
||||
* @api
|
||||
* @see AddCondition_ReferencedBy()
|
||||
*
|
||||
* @param DBObjectSearch $oFilter
|
||||
* @param $sExtKeyAttCode
|
||||
* @param int $iOperatorCode
|
||||
* @param null $aRealiasingMap array of <old-alias> => <new-alias>, for each alias that has changed
|
||||
* @param string $sExtKeyAttCode
|
||||
* @param int $iOperatorCode the comparison operator to use. For the list of all possible values, see the constant defined in core/oql/oqlquery.class.inc.php
|
||||
* @param array|null $aRealiasingMap array of <old-alias> => <new-alias>, for each alias that has changed in the newly attached oFilter (in case of collisions between the two filters)
|
||||
*
|
||||
* @throws CoreException
|
||||
* @throws CoreWarning
|
||||
*/
|
||||
abstract public function AddCondition_PointingTo(DBObjectSearch $oFilter, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null);
|
||||
|
||||
/**
|
||||
* Inverse operation of AddCondition_PointingTo
|
||||
*
|
||||
* The join is performed
|
||||
* * from the olFilter searched class, based on the $sExtKeyAttCode attribute
|
||||
* * against the searched class, based on its primary key
|
||||
* Note : if several classes have already being joined (SELECT a join b ON...), the first joined class (a in the example) is considered as being the searched class.
|
||||
*
|
||||
*
|
||||
* @api
|
||||
* @see AddCondition_PointingTo()
|
||||
*
|
||||
* @param DBObjectSearch $oFilter
|
||||
* @param $sForeignExtKeyAttCode
|
||||
* @param int $iOperatorCode
|
||||
* @param null $aRealiasingMap array of <old-alias> => <new-alias>, for each alias that has changed
|
||||
* @param array|null $aRealiasingMap array of <old-alias> => <new-alias>, for each alias that has changed in the newly attached oFilter (in case of collisions between the two filters)
|
||||
*/
|
||||
abstract public function AddCondition_ReferencedBy(DBObjectSearch $oFilter, $sForeignExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null);
|
||||
|
||||
/**
|
||||
* Filter the result
|
||||
*
|
||||
* The filter is performed by returning only the values in common with the given $oFilter
|
||||
* The impact on the resulting query performance/viability can be significant.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param DBSearch $oFilter
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function Intersect(DBSearch $oFilter);
|
||||
|
||||
/**
|
||||
* @param DBSearch $oFilter
|
||||
* @param integer $iDirection
|
||||
* @param string $sExtKeyAttCode
|
||||
* @param integer $iOperatorCode
|
||||
* @param array &$RealisasingMap Map of aliases from the attached query, that could have been renamed by the optimization process
|
||||
* Perform a join
|
||||
*
|
||||
* The join is performed against $oFilter selected class using $sExtKeyAttCode of the current selected class
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param DBSearch $oFilter The join is performed against $oFilter selected class
|
||||
* @param integer $iDirection can be either DBSearch::JOIN_POINTING_TO or DBSearch::JOIN_REFERENCED_BY
|
||||
* @param string $sExtKeyAttCode The join is performed against $sExtKeyAttCode wetheir it is compared aginst the current DBSearch or $oFilter depend of $iDirection
|
||||
* @param integer $iOperatorCode See DBSearch::AddCondition_PointingTo()
|
||||
* @param array|null $aRealiasingMap Map of aliases from the attached query, that could have been renamed by the optimization process
|
||||
*
|
||||
* @return DBSearch
|
||||
* @throws CoreException
|
||||
* @throws CoreWarning
|
||||
*/
|
||||
public function Join(DBSearch $oFilter, $iDirection, $sExtKeyAttCode, $iOperatorCode = TREE_OPERATOR_EQUALS, &$aRealiasingMap = null)
|
||||
{
|
||||
@@ -231,14 +484,46 @@ abstract class DBSearch
|
||||
return $oRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the internal params.
|
||||
*
|
||||
* If any params pre-existed, they are lost.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param mixed[string] $aParams array of mixed params index by string name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function SetInternalParams($aParams);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetInternalParams();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param bool $bExcludeMagicParams
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function GetQueryParams($bExcludeMagicParams = true);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function ListConstantFields();
|
||||
|
||||
/**
|
||||
* Turn the parameters (:xxx) into scalar values in order to easily
|
||||
* serialize a search
|
||||
* Turn the parameters (:xxx) into scalar values
|
||||
*
|
||||
* The goal is to easily serialize a search
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array $aArgs
|
||||
*
|
||||
@@ -246,6 +531,21 @@ abstract class DBSearch
|
||||
*/
|
||||
abstract public function ApplyParameters($aArgs);
|
||||
|
||||
/**
|
||||
* Convert a query to a string representation
|
||||
*
|
||||
* This operation can be revert back to a DBSearch using DBSearch::unserialize()
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::unserialize()
|
||||
*
|
||||
* @param bool $bDevelopParams
|
||||
* @param array $aContextParams
|
||||
*
|
||||
* @return false|string
|
||||
* @throws ArchivedObjectException
|
||||
* @throws CoreException
|
||||
*/
|
||||
public function serialize($bDevelopParams = false, $aContextParams = array())
|
||||
{
|
||||
$aQueryParams = $this->GetQueryParams();
|
||||
@@ -293,6 +593,10 @@ abstract class DBSearch
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a serialized query back to an instance of DBSearch
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param string $sValue Serialized OQL query
|
||||
*
|
||||
* @return \DBSearch
|
||||
@@ -336,11 +640,13 @@ abstract class DBSearch
|
||||
/**
|
||||
* Create a new DBObjectSearch from $oSearch with a new alias $sAlias
|
||||
*
|
||||
* Note : This has not be tested with UNION queries.
|
||||
* @internal Note : This has not be tested with UNION queries.
|
||||
*
|
||||
* @param DBSearch $oSearch
|
||||
* @param string $sAlias
|
||||
*
|
||||
* @return DBObjectSearch
|
||||
* @throws CoreException
|
||||
*/
|
||||
static public function CloneWithAlias(DBSearch $oSearch, $sAlias)
|
||||
{
|
||||
@@ -349,12 +655,37 @@ abstract class DBSearch
|
||||
return $oSearchWithAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the DBSearch to an OQL representation
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::FromOQL()
|
||||
*
|
||||
* @param bool $bDevelopParams
|
||||
* @param null $aContextParams
|
||||
* @param bool $bWithAllowAllFlag
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function ToOQL($bDevelopParams = false, $aContextParams = null, $bWithAllowAllFlag = false);
|
||||
|
||||
static protected $m_aOQLQueries = array();
|
||||
|
||||
// Do not filter out depending on user rights
|
||||
// In particular when we are currently in the process of evaluating the user rights...
|
||||
/**
|
||||
* FromOQL with AllowAllData enabled
|
||||
*
|
||||
* The goal is to not filter out depending on user rights.
|
||||
* In particular when we are currently in the process of evaluating the user rights...
|
||||
*
|
||||
* @internal
|
||||
* @see DBSearch::FromOQL()
|
||||
*
|
||||
* @param string $sQuery
|
||||
* @param null $aParams
|
||||
*
|
||||
* @return DBSearch
|
||||
* @throws OQLException
|
||||
*/
|
||||
static public function FromOQL_AllData($sQuery, $aParams = null)
|
||||
{
|
||||
$oRes = self::FromOQL($sQuery, $aParams);
|
||||
@@ -363,9 +694,19 @@ abstract class DBSearch
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sQuery
|
||||
* @param array $aParams
|
||||
* @return self
|
||||
* Create a new DBSearch from the given OQL.
|
||||
*
|
||||
* This is the simplest way to create a DBSearch.
|
||||
* For almost every cases, this is the easiest way.
|
||||
*
|
||||
* @api
|
||||
* @see DBSearch::ToOQL()
|
||||
*
|
||||
* @param string $sQuery The OQL to convert to a DBSearch
|
||||
* @param mixed[string] $aParams array of <mixed> params index by <string> name
|
||||
*
|
||||
* @return DBObjectSearch|DBUnionSearch
|
||||
*
|
||||
* @throws OQLException
|
||||
*/
|
||||
static public function FromOQL($sQuery, $aParams = null)
|
||||
@@ -442,14 +783,20 @@ abstract class DBSearch
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the result has an array structure.
|
||||
*
|
||||
* Alternative to object mapping: the data are transfered directly into an array
|
||||
* This is 10 times faster than creating a set of objects, and makes sense when optimization is required
|
||||
* But this speed comes at the cost of not obtaining the easy to manipulates DBObject instances but simple array structure.
|
||||
*
|
||||
* @param array $aColumns
|
||||
* @internal
|
||||
*
|
||||
* @param array $aColumns The columns you'd like to fetch.
|
||||
* @param array $aOrderBy Array of '[<classalias>.]attcode' => bAscending
|
||||
* @param array $aArgs
|
||||
*
|
||||
* @return array|void
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
@@ -506,7 +853,11 @@ abstract class DBSearch
|
||||
protected static $m_aQueryStructCache = array();
|
||||
|
||||
|
||||
/** Generate a Group By SQL request from a search
|
||||
/**
|
||||
* Generate a Group By SQL query from the current search
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array $aArgs
|
||||
* @param array $aGroupByExpr array('alias' => Expression)
|
||||
* @param bool $bExcludeNullValues
|
||||
@@ -514,7 +865,9 @@ abstract class DBSearch
|
||||
* @param array $aOrderBy array('alias' => bool) true = ASC false = DESC
|
||||
* @param int $iLimitCount
|
||||
* @param int $iLimitStart
|
||||
*
|
||||
* @return string SQL query generated
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function MakeGroupByQuery($aArgs, $aGroupByExpr, $bExcludeNullValues = false, $aSelectExpr = array(), $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0)
|
||||
@@ -590,6 +943,10 @@ abstract class DBSearch
|
||||
|
||||
|
||||
/**
|
||||
* Generate a SQL query from the current search
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array|hash $aOrderBy Array of '[<classalias>.]attcode' => bAscending
|
||||
* @param array $aArgs
|
||||
* @param null $aAttToLoad
|
||||
@@ -684,9 +1041,33 @@ abstract class DBSearch
|
||||
return $sRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
protected abstract function IsDataFiltered();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return mixed
|
||||
*/
|
||||
protected abstract function SetDataFiltered();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $aOrderBy
|
||||
* @param $aArgs
|
||||
* @param $aAttToLoad
|
||||
* @param $aExtendedDataSpec
|
||||
* @param $iLimitCount
|
||||
* @param $iLimitStart
|
||||
* @param $bGetCount
|
||||
* @param null $aGroupByExpr
|
||||
* @param null $aSelectExpr
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $aGroupByExpr = null, $aSelectExpr = null)
|
||||
{
|
||||
$oSearch = $this;
|
||||
@@ -727,18 +1108,46 @@ abstract class DBSearch
|
||||
return $oSQLQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $aAttToLoad
|
||||
* @param $bGetCount
|
||||
* @param null $aGroupByExpr
|
||||
* @param null $aSelectedClasses
|
||||
* @param null $aSelectExpr
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public abstract function GetSQLQueryStructure(
|
||||
$aAttToLoad, $bGetCount, $aGroupByExpr = null, $aSelectedClasses = null, $aSelectExpr = null
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the current search conditions
|
||||
*
|
||||
* @internal
|
||||
* @see DBSearch $m_oSearchCondition
|
||||
*
|
||||
* @return \Expression
|
||||
*/
|
||||
public abstract function GetCriteria();
|
||||
|
||||
/**
|
||||
* Shortcut to add efficient IN condition
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param $sFilterCode
|
||||
* @param $aValues
|
||||
* @param bool $bPositiveMatch if true a `IN` is performed, if false, a `NOT IN` is performed
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public abstract function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return string a unique param name
|
||||
*/
|
||||
protected function GenerateUniqueParamName() {
|
||||
@@ -759,36 +1168,78 @@ abstract class DBSearch
|
||||
protected static $m_bIndentQueries = false;
|
||||
protected static $m_bOptimizeQueries = false;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function StartDebugQuery()
|
||||
{
|
||||
$aBacktrace = debug_backtrace();
|
||||
self::$m_bDebugQuery = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function StopDebugQuery()
|
||||
{
|
||||
self::$m_bDebugQuery = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param bool $bEnabled
|
||||
* @param bool $bUseAPC
|
||||
* @param int $iTimeToLive
|
||||
*/
|
||||
public static function EnableQueryCache($bEnabled, $bUseAPC, $iTimeToLive = 3600)
|
||||
{
|
||||
self::$m_bQueryCacheEnabled = $bEnabled;
|
||||
self::$m_bUseAPCCache = $bUseAPC;
|
||||
self::$m_iQueryCacheTTL = $iTimeToLive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $bEnabled
|
||||
*/
|
||||
public static function EnableQueryTrace($bEnabled)
|
||||
{
|
||||
self::$m_bTraceQueries = $bEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $bEnabled
|
||||
*/
|
||||
public static function EnableQueryIndentation($bEnabled)
|
||||
{
|
||||
self::$m_bIndentQueries = $bEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $bEnabled
|
||||
*/
|
||||
public static function EnableOptimizeQuery($bEnabled)
|
||||
{
|
||||
self::$m_bOptimizeQueries = $bEnabled;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $aOrderBy
|
||||
* @param $aArgs
|
||||
* @param $aAttToLoad
|
||||
* @param $aExtendedDataSpec
|
||||
* @param $iLimitCount
|
||||
* @param $iLimitStart
|
||||
* @param $bGetCount
|
||||
* @param $sSql
|
||||
*
|
||||
* @throws MySQLException
|
||||
*/
|
||||
protected function AddQueryTraceSelect($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $sSql)
|
||||
{
|
||||
if (self::$m_bTraceQueries)
|
||||
@@ -809,6 +1260,15 @@ abstract class DBSearch
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $aArgs
|
||||
* @param $aGroupByExpr
|
||||
* @param $sSql
|
||||
*
|
||||
* @throws MySQLException
|
||||
*/
|
||||
protected function AddQueryTraceGroupBy($aArgs, $aGroupByExpr, $sSql)
|
||||
{
|
||||
if (self::$m_bTraceQueries)
|
||||
@@ -824,6 +1284,15 @@ abstract class DBSearch
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param $aQueryData
|
||||
* @param $sOql
|
||||
* @param $sSql
|
||||
*
|
||||
* @throws MySQLException
|
||||
*/
|
||||
protected static function AddQueryTrace($aQueryData, $sOql, $sSql)
|
||||
{
|
||||
if (self::$m_bTraceQueries)
|
||||
@@ -854,6 +1323,9 @@ abstract class DBSearch
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function RecordQueryTrace()
|
||||
{
|
||||
if (!self::$m_bTraceQueries)
|
||||
@@ -914,6 +1386,10 @@ abstract class DBSearch
|
||||
file_put_contents($sAllQueries, $sLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $value
|
||||
*/
|
||||
protected static function DbgTrace($value)
|
||||
{
|
||||
if (!self::$m_bDebugQuery)
|
||||
@@ -949,7 +1425,9 @@ abstract class DBSearch
|
||||
|
||||
/**
|
||||
* Experimental!
|
||||
* todo: implement the change tracking
|
||||
* @todo implement the change tracking
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param $bArchive
|
||||
* @throws Exception
|
||||
@@ -1025,6 +1503,9 @@ abstract class DBSearch
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function UpdateContextFromUser()
|
||||
{
|
||||
$this->SetShowObsoleteData(utils::ShowObsoleteData());
|
||||
|
||||
@@ -20,8 +20,19 @@
|
||||
/**
|
||||
* A union of DBObjectSearches
|
||||
*
|
||||
* This search class represent an union over a collection of DBObjectSearch.
|
||||
* For clarity purpose, since only the constructor vary between DBObjectSearch and DBUnionSearch, all the API is documented on the common ancestor: DBSearch
|
||||
* Please refer to DBSearch's documentation
|
||||
*
|
||||
* @copyright Copyright (C) 2015-2017 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*
|
||||
*
|
||||
* @package iTopORM
|
||||
* @phpdoc-tunning-exclude-inherited this tag prevent PHPdoc from displaying inherited methods. This is done in order to force the API doc. location into DBSearch only.
|
||||
* @api
|
||||
* @see DBSearch
|
||||
* @see DBObjectSearch
|
||||
*/
|
||||
|
||||
class DBUnionSearch extends DBSearch
|
||||
@@ -29,6 +40,15 @@ class DBUnionSearch extends DBSearch
|
||||
protected $aSearches; // source queries
|
||||
protected $aSelectedClasses; // alias => classes (lowest common ancestors) computed at construction
|
||||
|
||||
/**
|
||||
* DBUnionSearch constructor.
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @param $aSearches
|
||||
*
|
||||
* @throws CoreException
|
||||
*/
|
||||
public function __construct($aSearches)
|
||||
{
|
||||
if (count ($aSearches) == 0)
|
||||
|
||||
@@ -97,8 +97,9 @@ define('MYSQL_ENGINE', 'innodb');
|
||||
|
||||
|
||||
/**
|
||||
* (API) The objects definitions as well as their mapping to the database
|
||||
* The objects definitions as well as their mapping to the database
|
||||
*
|
||||
* @api
|
||||
* @package iTopORM
|
||||
*/
|
||||
abstract class MetaModel
|
||||
@@ -1233,6 +1234,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return array
|
||||
@@ -1285,9 +1287,12 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sAttCode
|
||||
* @param bool $bExtended
|
||||
* Check it the given attribute exists in the specified class
|
||||
*
|
||||
* @api
|
||||
* @param string $sClass Class name
|
||||
* @param string $sAttCode Attribute code
|
||||
* @param bool $bExtended Allow the extended syntax: extkey_id->remote_attcode
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
@@ -1341,6 +1346,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1356,6 +1362,9 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given class name is actually a persistent class
|
||||
*
|
||||
* @api
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return bool
|
||||
@@ -1630,17 +1639,20 @@ abstract class MetaModel
|
||||
/**
|
||||
* array of ("classname" => array filterdef)
|
||||
*
|
||||
* @deprecated
|
||||
* @var array
|
||||
*/
|
||||
private static $m_aFilterDefs = array();
|
||||
/**
|
||||
* array of ("classname" => array of ("attcode"=>"sourceclass"))
|
||||
*
|
||||
* @deprecated
|
||||
* @var array
|
||||
*/
|
||||
private static $m_aFilterOrigins = array();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return mixed
|
||||
@@ -1653,6 +1665,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1670,6 +1683,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1688,6 +1702,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1705,6 +1720,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1722,6 +1738,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
@@ -1740,6 +1757,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sClass
|
||||
* @param string $sFilterCode
|
||||
* @param string $sOpCode
|
||||
@@ -1759,6 +1777,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $sFilterCode
|
||||
*
|
||||
* @return string
|
||||
@@ -1856,7 +1875,7 @@ abstract class MetaModel
|
||||
private static $m_aRelationInfos = array();
|
||||
|
||||
/**
|
||||
* TO BE DEPRECATED: use EnumRelationsEx instead
|
||||
* @deprecated Use EnumRelationsEx instead
|
||||
*
|
||||
* @param string $sClass
|
||||
*
|
||||
@@ -6643,12 +6662,13 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for the specified class and id.
|
||||
* Instantiate an object already persisted to the Database.
|
||||
*
|
||||
* @api
|
||||
* @param string $sClass
|
||||
* @param int $iKey id value of the object to retrieve
|
||||
* @param bool $bMustBeFound see throws ArchivedObjectException
|
||||
* @param bool $bAllowAllData if true then no rights filtering
|
||||
* @param bool $bAllowAllData if true then user rights will be bypassed - use with care!
|
||||
* @param null $aModifierProperties
|
||||
*
|
||||
* @return DBObject|null null if : (the object is not found) or (archive mode disabled and object is archived and
|
||||
@@ -6859,8 +6879,11 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param array|null $aValues array of attcode => value
|
||||
* Instantiate a persistable object (not yet persisted)
|
||||
*
|
||||
* @api
|
||||
* @param string $sClass A persistable class
|
||||
* @param array|null $aValues array of attcode => attribute value to preset
|
||||
*
|
||||
* @return DBObject
|
||||
* @throws \CoreException
|
||||
@@ -6905,6 +6928,8 @@ abstract class MetaModel
|
||||
* @todo: protect it against forbidden usages (in such a case, delete objects one by one)
|
||||
*
|
||||
* @param \DBObjectSearch $oFilter
|
||||
* @deprecated
|
||||
* @experimental
|
||||
*
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
@@ -6922,6 +6947,8 @@ abstract class MetaModel
|
||||
* @param DBObjectSearch $oFilter
|
||||
* @param array $aValues array of attcode => value
|
||||
*
|
||||
* @deprecated
|
||||
* @experimental
|
||||
* @return int Modified objects
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/d3.min.js'|add_itop_version }}"></script>
|
||||
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/c3.min.js'|add_itop_version }}"></script>
|
||||
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/bootstrap/js/bootstrap.min.js'|add_itop_version }}"></script>
|
||||
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'js/bootstrap-patches.js'|add_itop_version }}"></script>
|
||||
<script type="text/javascript" src="{{ app['combodo.absolute_url'] ~ 'js/latinise/latinise.min.js'|add_itop_version }}"></script>
|
||||
{# Visible.js to check if an element is visible on screen #}
|
||||
<script type="text/javascript" src="{{ app['combodo.portal.base.absolute_url'] ~ 'lib/jquery-visible/js/jquery.visible.min.js'|add_itop_version }}"></script>
|
||||
@@ -458,13 +459,6 @@
|
||||
$(this).removeData('bs.modal');
|
||||
$(this).find('.modal-content').html(GetContentLoaderTemplate());
|
||||
});
|
||||
// Hack to enable multiple modals by making sure the .modal-open class is set to the <body> when there is at least one modal open left
|
||||
$('body').on('hidden.bs.modal', function () {
|
||||
if($('.modal.in').length > 0)
|
||||
{
|
||||
$('body').addClass('modal-open');
|
||||
}
|
||||
});
|
||||
// Hide tooltips when a modal is opening, otherwise it might be overlapping it
|
||||
$('body').on('show.bs.modal', function () {
|
||||
$(this).find('.tooltip.in').tooltip('hide');
|
||||
|
||||
26
datamodels/2.x/itop-portal-base/portal/web/js/bootstrap-patches.js
vendored
Normal file
26
datamodels/2.x/itop-portal-base/portal/web/js/bootstrap-patches.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Patches for bootstrap 3 as it is no longer maintained by its editor
|
||||
*/
|
||||
|
||||
//N°2166: Fix a boostrap/CKeditor incompatibility with their respective modals (source: https://stackoverflow.com/a/23667151)
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function () {
|
||||
var $modalElement = this.$element;
|
||||
$(document).on('focusin.modal', function (e) {
|
||||
var $parent = $(e.target.parentNode);
|
||||
if ($modalElement[0] !== e.target && !$modalElement.has(e.target).length
|
||||
// add whatever conditions you need here:
|
||||
&&
|
||||
!$parent.hasClass('cke_dialog_ui_input_select') && !$parent.hasClass('cke_dialog_ui_input_text')) {
|
||||
$modalElement.focus()
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
// Hack to enable multiple modals by making sure the .modal-open class is set to the <body> when there is at least one modal open left
|
||||
$(document).ready(function() {
|
||||
$('body').on('hidden.bs.modal', function () {
|
||||
if ($('.modal.in').length > 0) {
|
||||
$('body').addClass('modal-open');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -42,6 +42,16 @@ $(function()
|
||||
{
|
||||
var me = this;
|
||||
|
||||
// when the allowed valued indexes has sequentially & numerical keys, they are passed has an array which break some further code, let's enforce them as an object.
|
||||
if (Array.isArray(this.options.field.allowed_values.values))
|
||||
{
|
||||
var arrayValues = this.options.field.allowed_values.values;
|
||||
this.options.field.allowed_values.values = {};
|
||||
for (var i = 0; i < arrayValues.length; i++) {
|
||||
this.options.field.allowed_values.values[i] = arrayValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
this._super();
|
||||
this.element.addClass('search_form_criteria_enum');
|
||||
},
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdoc>
|
||||
<title><![CDATA[iTop extensions]]></title>
|
||||
<parser>
|
||||
<target>/var/www/doc-extensions</target>
|
||||
</parser>
|
||||
<transformer>
|
||||
<target>/var/www/doc-extensions</target>
|
||||
</transformer>
|
||||
<files>
|
||||
<file>/home/romain/itop-trunk/application/applicationextension.inc.php</file>
|
||||
</files>
|
||||
</phpdoc>
|
||||
@@ -57,7 +57,11 @@ class WizStepWelcome extends WizardStep
|
||||
|
||||
public function ProcessParams($bMoveForward = true)
|
||||
{
|
||||
if (!file_exists(APPROOT.'data/setup'))
|
||||
if (!is_dir(APPROOT.'data'))
|
||||
{
|
||||
mkdir(APPROOT.'data');
|
||||
}
|
||||
if (!is_dir(APPROOT.'data/setup'))
|
||||
{
|
||||
mkdir(APPROOT.'data/setup');
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ class SearchForm
|
||||
|
||||
foreach($aAttributeDefs as $sAttCode => $oAttDef)
|
||||
{
|
||||
if ($this->IsSubAttribute($oAttDef)) continue;
|
||||
if ($oAttDef instanceof AttributeFriendlyName) continue; //it was already forced into $aZList in the code above
|
||||
|
||||
$bHasIndex = isset($aIndexes[$sAttCode]);
|
||||
$aOthers = $this->AppendField($sClass, $sAlias, $sAttCode, $oAttDef, $aOthers, $bHasIndex);
|
||||
@@ -414,10 +414,6 @@ class SearchForm
|
||||
return $aDBIndexes;
|
||||
}
|
||||
|
||||
protected function IsSubAttribute($oAttDef)
|
||||
{
|
||||
return (($oAttDef instanceof AttributeFriendlyName) || ($oAttDef instanceof AttributeSubItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \AttributeDefinition $oAttrDef
|
||||
|
||||
@@ -135,6 +135,7 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
{
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
$value = $iObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -163,6 +163,7 @@ EOF
|
||||
{
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = 'checked';
|
||||
$value = $sChoice;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,14 +28,17 @@
|
||||
// - reconciliation is made on the column primary_key
|
||||
//
|
||||
|
||||
if (!defined('__DIR__')) define('__DIR__', dirname(__FILE__));
|
||||
require_once(__DIR__.'/../approot.inc.php');
|
||||
require_once(APPROOT.'/application/application.inc.php');
|
||||
require_once(APPROOT.'/application/webpage.class.inc.php');
|
||||
require_once(APPROOT.'/application/csvpage.class.inc.php');
|
||||
require_once(APPROOT.'/application/clipage.class.inc.php');
|
||||
|
||||
require_once(APPROOT.'/application/startup.inc.php');
|
||||
if (!defined('__DIR__'))
|
||||
{
|
||||
/** @noinspection DirectoryConstantCanBeUsedInspection */
|
||||
define('__DIR__', dirname(__FILE__));
|
||||
}
|
||||
require_once __DIR__.'/../approot.inc.php';
|
||||
require_once APPROOT.'/application/application.inc.php';
|
||||
require_once APPROOT.'/application/webpage.class.inc.php';
|
||||
require_once APPROOT.'/application/csvpage.class.inc.php';
|
||||
require_once APPROOT.'/application/clipage.class.inc.php';
|
||||
require_once APPROOT.'/application/startup.inc.php';
|
||||
|
||||
class ExchangeException extends Exception
|
||||
{
|
||||
@@ -170,7 +173,7 @@ function UsageAndExit($oP)
|
||||
$aModes = explode(',', $aParamData['modes']);
|
||||
if ($bModeCLI)
|
||||
{
|
||||
if (in_array('cli', $aModes))
|
||||
if (in_array('cli', $aModes, false))
|
||||
{
|
||||
$sDesc = $aParamData['description'].', '.($aParamData['mandatory'] ? 'mandatory' : 'optional, defaults to ['.$aParamData['default'].']');
|
||||
$oP->p("$sParam = $sDesc");
|
||||
@@ -178,7 +181,7 @@ function UsageAndExit($oP)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_array('http', $aModes))
|
||||
if (in_array('http', $aModes, false))
|
||||
{
|
||||
$sDesc = $aParamData['description'].', '.($aParamData['mandatory'] ? 'mandatory' : 'optional, defaults to ['.$aParamData['default'].']');
|
||||
$oP->p("$sParam = $sDesc");
|
||||
@@ -196,6 +199,7 @@ function ReadParam($oP, $sParam, $sSanitizationFilter = 'parameter')
|
||||
assert(isset($aPageParams[$sParam]));
|
||||
assert(!$aPageParams[$sParam]['mandatory']);
|
||||
$sValue = utils::ReadParam($sParam, $aPageParams[$sParam]['default'], true /* Allow CLI */, $sSanitizationFilter);
|
||||
|
||||
return trim($sValue);
|
||||
}
|
||||
|
||||
@@ -206,17 +210,18 @@ function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter)
|
||||
assert($aPageParams[$sParam]['mandatory']);
|
||||
|
||||
$sValue = utils::ReadParam($sParam, null, true /* Allow CLI */, $sSanitizationFilter);
|
||||
if (is_null($sValue))
|
||||
if ($sValue === null)
|
||||
{
|
||||
$oP->p("ERROR: Missing argument '$sParam'\n");
|
||||
UsageAndExit($oP);
|
||||
}
|
||||
|
||||
return trim($sValue);
|
||||
}
|
||||
|
||||
function ChangeDateFormat($sProposedDate, $sFormat, $bDateOnly)
|
||||
{
|
||||
if ($sProposedDate == '')
|
||||
if ($sProposedDate === '')
|
||||
{
|
||||
// An empty string means 'reset'
|
||||
return '';
|
||||
@@ -228,21 +233,18 @@ function ChangeDateFormat($sProposedDate, $sFormat, $bDateOnly)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$oDate = $oFormat->Parse($sProposedDate);
|
||||
if ($oDate !== null)
|
||||
{
|
||||
$oTargetFormat = $bDateOnly ? AttributeDate::GetInternalFormat() : AttributeDateTime::GetInternalFormat();
|
||||
$sDate = $oDate->format($oTargetFormat);
|
||||
|
||||
return $sDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CLILikeWebPage extends WebPage
|
||||
@@ -258,11 +260,11 @@ class CLILikeWebPage extends WebPage
|
||||
|
||||
if (utils::IsModeCLI())
|
||||
{
|
||||
$oP = new CLIPage(Dict::S("TitleSynchroExecution"));
|
||||
$oP = new CLIPage(Dict::S('TitleSynchroExecution'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$oP = new CLILikeWebPage(Dict::S("TitleSynchroExecution"));
|
||||
$oP = new CLILikeWebPage(Dict::S('TitleSynchroExecution'));
|
||||
}
|
||||
|
||||
try
|
||||
@@ -307,10 +309,10 @@ if (utils::IsModeCLI())
|
||||
else
|
||||
{
|
||||
$_SESSION['login_mode'] = 'basic';
|
||||
require_once(APPROOT.'/application/loginwebpage.class.inc.php');
|
||||
require_once APPROOT.'/application/loginwebpage.class.inc.php';
|
||||
LoginWebPage::DoLogin(); // Check user rights and prompt if needed
|
||||
|
||||
$sCSVData = utils::ReadPostedParam('csvdata', '', false, 'raw_data');
|
||||
$sCSVData = utils::ReadPostedParam('csvdata', '', 'raw_data');
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +328,7 @@ try
|
||||
$sQualifier = ReadParam($oP, 'qualifier', 'raw_data');
|
||||
$sCharSet = ReadParam($oP, 'charset', 'raw_data');
|
||||
$sDateTimeFormat = ReadParam($oP, 'date_format', 'raw_data');
|
||||
if ($sDateTimeFormat == '')
|
||||
if ($sDateTimeFormat === '')
|
||||
{
|
||||
$sDateTimeFormat = 'Y-m-d H:i:s'; // By default use the SQL date & time format
|
||||
}
|
||||
@@ -342,15 +344,14 @@ try
|
||||
$sComment = ReadParam($oP, 'comment', 'raw_data');
|
||||
$sNoStopOnImportError = ReadParam($oP, 'no_stop_on_import_error');
|
||||
|
||||
if (strtolower(trim($sSep)) == 'tab')
|
||||
if (strtolower(trim($sSep)) === 'tab')
|
||||
{
|
||||
$sSep = "\t";
|
||||
}
|
||||
|
||||
// In case there is a difference between the web server time and the DB server time,
|
||||
// use the DB server time as a reference since this date/time will be compared with the "status_last_seen"
|
||||
// column, which is populated by MySQL triggers (and so based on the DB server time)
|
||||
$oLoadStartDate = new DateTime(CMDBSource::QueryToScalar('SELECT NOW()')); // Now... but as read from the database
|
||||
// Saving script launch datetime : if we're doing both import AND exec phases (--synchronize=1 parameter)
|
||||
// then exec phase will need this !
|
||||
$oLoadStartDate = SynchroExecution::GetDataBaseCurrentDateTime();
|
||||
|
||||
// Note about date formatting: These MySQL settings are read-only... and in fact unused :-(
|
||||
// SET SESSION date_format = '%d/%m/%Y';
|
||||
@@ -370,13 +371,14 @@ try
|
||||
//
|
||||
// Check parameters format/consistency
|
||||
//
|
||||
if (strlen($sCSVData) == 0)
|
||||
if (strlen($sCSVData) === 0)
|
||||
{
|
||||
throw new ExchangeException("Missing data - at least one line is expected");
|
||||
throw new ExchangeException('Missing data - at least one line is expected');
|
||||
}
|
||||
|
||||
/** @var \SynchroDataSource $oDataSource */
|
||||
$oDataSource = MetaModel::GetObject('SynchroDataSource', $iDataSourceId, false);
|
||||
if (is_null($oDataSource))
|
||||
if ($oDataSource === null)
|
||||
{
|
||||
throw new ExchangeException("Unknown data source id: '$iDataSourceId'");
|
||||
}
|
||||
@@ -408,7 +410,7 @@ try
|
||||
}
|
||||
*/
|
||||
|
||||
if ($sSimulate == '1')
|
||||
if ($sSimulate === '1')
|
||||
{
|
||||
$bSimulate = true;
|
||||
}
|
||||
@@ -417,7 +419,7 @@ try
|
||||
$bSimulate = false;
|
||||
}
|
||||
|
||||
if ($sSynchronize == '1')
|
||||
if ($sSynchronize === '1')
|
||||
{
|
||||
$bSynchronize = true;
|
||||
}
|
||||
@@ -430,7 +432,7 @@ try
|
||||
//
|
||||
// Parse first line, check attributes, analyse the request
|
||||
//
|
||||
if ($sCharSet == 'UTF-8')
|
||||
if ($sCharSet === 'UTF-8')
|
||||
{
|
||||
$sUTF8Data = $sCSVData;
|
||||
}
|
||||
@@ -473,7 +475,7 @@ try
|
||||
$aIsDateToTransform[$iFieldId] = false;
|
||||
}
|
||||
|
||||
if ($sInputColumn == 'primary_key')
|
||||
if ($sInputColumn === 'primary_key')
|
||||
{
|
||||
$iPrimaryKeyCol = $iFieldId;
|
||||
continue;
|
||||
@@ -494,7 +496,7 @@ try
|
||||
//
|
||||
try
|
||||
{
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment(' Import phase');
|
||||
@@ -517,20 +519,20 @@ try
|
||||
$iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
|
||||
$oMutex = new iTopMutex('synchro_import_'.$oDataSource->GetKey());
|
||||
$oMutex->Lock();
|
||||
set_time_limit($iLoopTimeLimit);
|
||||
foreach ($aData as $iRow => $aRow)
|
||||
{
|
||||
set_time_limit($iLoopTimeLimit);
|
||||
$sReconciliationCondition = "`primary_key` = ".CMDBSource::Quote($aRow[$iPrimaryKeyCol]);
|
||||
$sReconciliationCondition = '`primary_key` = '.CMDBSource::Quote($aRow[$iPrimaryKeyCol]);
|
||||
$sSelect = "SELECT COUNT(*) FROM `$sTable` WHERE $sReconciliationCondition";
|
||||
$aRes = CMDBSource::QueryToArray($sSelect);
|
||||
$iCount = $aRes[0]['COUNT(*)'];
|
||||
|
||||
if ($iCount == 0)
|
||||
if ($iCount === 0)
|
||||
{
|
||||
// No record... create it
|
||||
//
|
||||
$iCountCreations++;
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add("$iRow: New entry, reconciliation: '$sReconciliationCondition'\n");
|
||||
}
|
||||
@@ -538,7 +540,7 @@ try
|
||||
$aValues = array(); // Used to build the insert query
|
||||
foreach ($aRow as $iCol => $value)
|
||||
{
|
||||
if (is_null($value))
|
||||
if ($value === null)
|
||||
{
|
||||
$aValues[] = 'NULL';
|
||||
}
|
||||
@@ -546,7 +548,7 @@ try
|
||||
{
|
||||
$bDateOnly = false;
|
||||
$sFormat = $sDateTimeFormat;
|
||||
if ($aIsDateToTransform[$iCol] == 'DATE')
|
||||
if ($aIsDateToTransform[$iCol] === 'DATE')
|
||||
{
|
||||
$bDateOnly = true;
|
||||
$sFormat = $sDateFormat;
|
||||
@@ -555,7 +557,7 @@ try
|
||||
if ($sDate === false)
|
||||
{
|
||||
$aValues[] = CMDBSource::Quote('');
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add("$iRow: Wrong format for {$aIsDateToTransform[$iCol]} column $iCol: '$value' does not match the expected format: '$sFormat' (column skipped)\n");
|
||||
}
|
||||
@@ -578,7 +580,7 @@ try
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($sNoStopOnImportError == '1')
|
||||
if ($sNoStopOnImportError === '1')
|
||||
{
|
||||
$iCountErrors++;
|
||||
$oP->add("$iRow: Import error '".$e->getMessage()."' (continuing)...\n");
|
||||
@@ -589,28 +591,30 @@ try
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($iCount == 1)
|
||||
elseif ($iCount === 1)
|
||||
{
|
||||
// Found a match... update it
|
||||
//
|
||||
$iCountUpdates++;
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add("$iRow: Update entry, reconciliation: '$sReconciliationCondition'\n");
|
||||
}
|
||||
|
||||
$aValuePairs = array(); // Used to build the update query
|
||||
foreach ($aRow as $iCol => $value)
|
||||
{
|
||||
// Skip reconciliation column
|
||||
if ($iCol == $iPrimaryKeyCol) continue;
|
||||
if ($iCol === $iPrimaryKeyCol)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$sCol = $aInputColumns[$iCol];
|
||||
if ($aIsDateToTransform[$iCol] !== false)
|
||||
{
|
||||
$bDateOnly = false;
|
||||
$sFormat = $sDateTimeFormat;
|
||||
if ($aIsDateToTransform[$iCol] == 'DATE')
|
||||
if ($aIsDateToTransform[$iCol] === 'DATE')
|
||||
{
|
||||
$bDateOnly = true;
|
||||
$sFormat = $sDateFormat;
|
||||
@@ -618,7 +622,7 @@ try
|
||||
$sDate = ChangeDateFormat($value, $sFormat, $bDateOnly);
|
||||
if ($sDate === false)
|
||||
{
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add("$iRow: Wrong format for {$aIsDateToTransform[$iCol]} column $iCol: '$value' does not match the expected format: '$sFormat' (column skipped)\n");
|
||||
}
|
||||
@@ -641,7 +645,7 @@ try
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($sNoStopOnImportError == '1')
|
||||
if ($sNoStopOnImportError === '1')
|
||||
{
|
||||
$iCountErrors++;
|
||||
$oP->add("$iRow: Import error '".$e->getMessage()."' (continuing)...\n");
|
||||
@@ -663,17 +667,17 @@ try
|
||||
$oMutex->Unlock();
|
||||
set_time_limit($iPreviousTimeLimit);
|
||||
|
||||
if (($sOutput == "summary") || ($sOutput == 'details'))
|
||||
if (($sOutput === 'summary') || ($sOutput === 'details'))
|
||||
{
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment(' Import phase summary');
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment("Data Source: ".$iDataSourceId);
|
||||
$oP->add_comment("Synchronize: ".($bSynchronize ? '1' : '0'));
|
||||
$oP->add_comment("Class: ".$sClass);
|
||||
$oP->add_comment("Separator: ".$sSep);
|
||||
$oP->add_comment("Qualifier: ".$sQualifier);
|
||||
$oP->add_comment("Charset Encoding:".$sCharSet);
|
||||
$oP->add_comment('Data Source: '.$iDataSourceId);
|
||||
$oP->add_comment('Synchronize: '.($bSynchronize ? '1' : '0'));
|
||||
$oP->add_comment('Class: '.$sClass);
|
||||
$oP->add_comment('Separator: '.$sSep);
|
||||
$oP->add_comment('Qualifier: '.$sQualifier);
|
||||
$oP->add_comment('Charset Encoding:'.$sCharSet);
|
||||
|
||||
if (strlen($sDateTimeFormat) > 0)
|
||||
{
|
||||
@@ -684,7 +688,7 @@ try
|
||||
if ($sType !== false)
|
||||
{
|
||||
$sCol = $aInputColumns[$iCol];
|
||||
if ($sType == 'DATE')
|
||||
if ($sType === 'DATE')
|
||||
{
|
||||
$aDateColumns[] = $sCol;
|
||||
}
|
||||
@@ -694,7 +698,8 @@ try
|
||||
}
|
||||
}
|
||||
}
|
||||
$sFormatedDateTimeColumns = (count($aDateTimeColumns) > 0) ? ', applied to columns ['.implode(', ', $aDateTimeColumns).']' : '';
|
||||
$sFormatedDateTimeColumns = (count($aDateTimeColumns) > 0) ? ', applied to columns ['.implode(', ',
|
||||
$aDateTimeColumns).']' : '';
|
||||
$sFormatedDateColumns = (count($aDateColumns) > 0) ? ', applied to columns ['.implode(', ', $aDateColumns).']' : '';
|
||||
$oP->add_comment("Date and time format: '$sDateTimeFormat' $sFormatedDateTimeColumns");
|
||||
$oP->add_comment("Date only format: '$sDateFormat' $sFormatedDateColumns");
|
||||
@@ -702,19 +707,19 @@ try
|
||||
else
|
||||
{
|
||||
// shall never get there
|
||||
$oP->add_comment("Date format: <none>");
|
||||
$oP->add_comment('Date format: <none>');
|
||||
}
|
||||
$oP->add_comment("Data Size: ".strlen($sCSVData));
|
||||
$oP->add_comment("Data Lines: ".$iLineCount);
|
||||
$oP->add_comment("Columns: ".implode(', ', $aInputColumns));
|
||||
$oP->add_comment("Output format: ".$sOutput);
|
||||
$oP->add_comment('Data Size: '.strlen($sCSVData));
|
||||
$oP->add_comment('Data Lines: '.$iLineCount);
|
||||
$oP->add_comment('Columns: '.implode(', ', $aInputColumns));
|
||||
$oP->add_comment('Output format: '.$sOutput);
|
||||
// $oP->add_comment("Report level: ".$sReportLevel);
|
||||
$oP->add_comment("Simulate: ".($bSimulate ? '1' : '0'));
|
||||
$oP->add_comment("Change tracking comment: ".$sComment);
|
||||
$oP->add_comment("Issues (before synchro): ".$iCountErrors);
|
||||
$oP->add_comment('Simulate: '.($bSimulate ? '1' : '0'));
|
||||
$oP->add_comment('Change tracking comment: '.$sComment);
|
||||
$oP->add_comment('Issues (before synchro): '.$iCountErrors);
|
||||
// $oP->add_comment("Warnings: ".$iCountWarnings);
|
||||
$oP->add_comment("Created (before synchro): ".$iCountCreations);
|
||||
$oP->add_comment("Updated (before synchro): ".$iCountUpdates);
|
||||
$oP->add_comment('Created (before synchro): '.$iCountCreations);
|
||||
$oP->add_comment('Updated (before synchro): '.$iCountUpdates);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -725,7 +730,7 @@ try
|
||||
{
|
||||
$oSynchroExec = new SynchroExecution($oDataSource, $oLoadStartDate);
|
||||
$oStatLog = $oSynchroExec->Process();
|
||||
if ($sOutput == 'details')
|
||||
if ($sOutput === 'details')
|
||||
{
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment(' Synchronization phase');
|
||||
@@ -736,32 +741,32 @@ try
|
||||
$iCount++;
|
||||
$oP->add_comment($sMessage);
|
||||
}
|
||||
if ($iCount == 0)
|
||||
if ($iCount === 0)
|
||||
{
|
||||
$oP->add_comment(' No traces. (To activate the traces set "synchro_trace" => true in the configuration file)');
|
||||
}
|
||||
}
|
||||
if ($oStatLog->Get('status') == 'error')
|
||||
if ($oStatLog->Get('status') === 'error')
|
||||
{
|
||||
$oP->p("ERROR: ".$oStatLog->Get('last_error'));
|
||||
$oP->p('ERROR: '.$oStatLog->Get('last_error'));
|
||||
}
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment(' Synchronization phase summary');
|
||||
$oP->add_comment('------------------------------------------------------------');
|
||||
$oP->add_comment("Replicas: ".$oStatLog->Get('stats_nb_replica_total'));
|
||||
$oP->add_comment("Replicas touched since last synchro: ".$oStatLog->Get('stats_nb_replica_seen'));
|
||||
$oP->add_comment("Objects deleted: ".$oStatLog->Get('stats_nb_obj_deleted'));
|
||||
$oP->add_comment("Objects deletion errors: ".$oStatLog->Get('stats_nb_obj_deleted_errors'));
|
||||
$oP->add_comment("Objects obsoleted: ".$oStatLog->Get('stats_nb_obj_obsoleted'));
|
||||
$oP->add_comment("Objects obsolescence errors: ".$oStatLog->Get('stats_nb_obj_obsoleted_errors'));
|
||||
$oP->add_comment("Objects created: ".$oStatLog->Get('stats_nb_obj_created')." (".$oStatLog->Get('stats_nb_obj_created_warnings')." warnings)");
|
||||
$oP->add_comment("Objects creation errors: ".$oStatLog->Get('stats_nb_obj_created_errors'));
|
||||
$oP->add_comment("Objects updated: ".$oStatLog->Get('stats_nb_obj_updated')." (".$oStatLog->Get('stats_nb_obj_updated_warnings')." warnings)");
|
||||
$oP->add_comment("Objects update errors: ".$oStatLog->Get('stats_nb_obj_updated_errors'));
|
||||
$oP->add_comment("Objects reconciled (updated): ".$oStatLog->Get('stats_nb_obj_new_updated')." (".$oStatLog->Get('stats_nb_obj_new_updated_warnings')." warnings)");
|
||||
$oP->add_comment("Objects reconciled (unchanged): ".$oStatLog->Get('stats_nb_obj_new_unchanged')." (".$oStatLog->Get('stats_nb_obj_new_updated_warnings')." warnings)");
|
||||
$oP->add_comment("Objects reconciliation errors: ".$oStatLog->Get('stats_nb_replica_reconciled_errors'));
|
||||
$oP->add_comment("Replica disappeared, no action taken: ".$oStatLog->Get('stats_nb_replica_disappeared_no_action'));
|
||||
$oP->add_comment('Replicas: '.$oStatLog->Get('stats_nb_replica_total'));
|
||||
$oP->add_comment('Replicas touched since last synchro: '.$oStatLog->Get('stats_nb_replica_seen'));
|
||||
$oP->add_comment('Objects deleted: '.$oStatLog->Get('stats_nb_obj_deleted'));
|
||||
$oP->add_comment('Objects deletion errors: '.$oStatLog->Get('stats_nb_obj_deleted_errors'));
|
||||
$oP->add_comment('Objects obsoleted: '.$oStatLog->Get('stats_nb_obj_obsoleted'));
|
||||
$oP->add_comment('Objects obsolescence errors: '.$oStatLog->Get('stats_nb_obj_obsoleted_errors'));
|
||||
$oP->add_comment('Objects created: '.$oStatLog->Get('stats_nb_obj_created').' ('.$oStatLog->Get('stats_nb_obj_created_warnings').' warnings)');
|
||||
$oP->add_comment('Objects creation errors: '.$oStatLog->Get('stats_nb_obj_created_errors'));
|
||||
$oP->add_comment('Objects updated: '.$oStatLog->Get('stats_nb_obj_updated').' ('.$oStatLog->Get('stats_nb_obj_updated_warnings')." warnings)");
|
||||
$oP->add_comment('Objects update errors: '.$oStatLog->Get('stats_nb_obj_updated_errors'));
|
||||
$oP->add_comment('Objects reconciled (updated): '.$oStatLog->Get('stats_nb_obj_new_updated').' ('.$oStatLog->Get('stats_nb_obj_new_updated_warnings').' warnings)');
|
||||
$oP->add_comment('Objects reconciled (unchanged): '.$oStatLog->Get('stats_nb_obj_new_unchanged').' ('.$oStatLog->Get('stats_nb_obj_new_updated_warnings').' warnings)');
|
||||
$oP->add_comment('Objects reconciliation errors: '.$oStatLog->Get('stats_nb_replica_reconciled_errors'));
|
||||
$oP->add_comment('Replica disappeared, no action taken: '.$oStatLog->Get('stats_nb_replica_disappeared_no_action'));
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
@@ -781,7 +786,7 @@ try
|
||||
//
|
||||
// Summary of settings and results
|
||||
//
|
||||
if ($sOutput == 'retcode')
|
||||
if ($sOutput === 'retcode')
|
||||
{
|
||||
$oP->add($iCountErrors);
|
||||
}
|
||||
@@ -790,14 +795,9 @@ catch(ExchangeException $e)
|
||||
{
|
||||
$oP->add_comment($e->getMessage());
|
||||
}
|
||||
catch(SecurityException $e)
|
||||
{
|
||||
$oP->add_comment($e->getMessage());
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$oP->add_comment((string)$e);
|
||||
}
|
||||
|
||||
$oP->output();
|
||||
?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user